<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>Kubuntu Forums - Coding/Scripting</title>
		<link>https://www.kubuntuforums.net/</link>
		<description>Get help writing code or post new code for others to use</description>
		<language>en</language>
		<lastBuildDate>Thu, 30 Apr 2026 07:53:10 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>images/misc/rss.png</url>
			<title>Kubuntu Forums - Coding/Scripting</title>
			<link>https://www.kubuntuforums.net/</link>
		</image>
		<item>
			<title><![CDATA[[Abandoned] Trying to get two actions on a single file in a Dolphin Service menu]]></title>
			<link>https://www.kubuntuforums.net/forum/general/miscellaneous/coding-scripting/691173-abandoned-trying-to-get-two-actions-on-a-single-file-in-a-dolphin-service-menu</link>
			<pubDate>Tue, 07 Apr 2026 12:49:52 GMT</pubDate>
			<description>I use Dolphin service menus to extract subtitles from video files. Then, if the subtitle is ssa format, I use a second service menu to convert it to...</description>
			<content:encoded><![CDATA[I use Dolphin service menus to extract subtitles from video files. Then, if the subtitle is ssa format, I use a second service menu to convert it to srt. Independently, they both work fine. I'd like to combine this into a single service menu; i.e extract and convert automatically when the file type is ssa.<br />
<br />
The subtitle extraction is done with a python script that I call from the service menu like this: 
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	
	<pre class="bbcode_code" style="max-height:calc(30 *  + 12px + 20px);">Exec=$HOME/.local/share/applications/mkvextract-allsubs-eng %u</pre>
</div>The conversion to srt is much simpler and uses ffmpeg, so it's a one-liner: 
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	
	<pre class="bbcode_code" style="max-height:calc(30 *  + 12px + 20px);">ffmpeg -i &quot;$fn&quot; &quot;${fn%.*}&quot;.srt</pre>
</div>I suspect I could add the conversion function to the python script, but I don't know python at all - the python script is something I found on the 'net.<br />
<br />
I have attempted this in the service menu:
<div class="bbcode_container">
	<div class="bbcode_description">Code:</div>
	
	<pre class="bbcode_code" style="max-height:calc(30 *  + 12px + 20px);">Exec=$HOME/.local/share/applications/mkvextract-allsubs-eng %u; fn=%u; if &#91;&#91; &quot;${fn#&quot;${fn%???}&quot;}&quot; = &quot;ssa&quot; &#93;&#93;; then ffmpeg -i &quot;$fn&quot; &quot;${fn%.*}&quot;.srt; rm &quot;$fn&quot;; fi</pre>
</div>The results are the extraction occurs but not the conversion.<br />
<br />
All the pieces in the if statement work from the command line so I think the issue is in the Service Menu action itself - like once the python script is called the service menu stops provessing.<br />
<br />
Looking for ideas..]]></content:encoded>
			<category domain="https://www.kubuntuforums.net/forum/general/miscellaneous/coding-scripting">Coding/Scripting</category>
			<dc:creator>oshunluvr</dc:creator>
			<guid isPermaLink="true">https://www.kubuntuforums.net/forum/general/miscellaneous/coding-scripting/691173-abandoned-trying-to-get-two-actions-on-a-single-file-in-a-dolphin-service-menu</guid>
		</item>
	</channel>
</rss>
