Skip to content

Instantly share code, notes, and snippets.

@bepvte
Last active November 1, 2021 22:27
Show Gist options
  • Save bepvte/f433077e22a23a9b4c956b3d2da72664 to your computer and use it in GitHub Desktop.
Save bepvte/f433077e22a23a9b4c956b3d2da72664 to your computer and use it in GitHub Desktop.
youtube dl tasker and termux script
<TaskerData sr="" dvi="1" tv="5.11.14">
<Profile sr="prof4" ve="2">
<cdate>1576557674021</cdate>
<edate>1616439546629</edate>
<flags>8</flags>
<id>4</id>
<mid0>5</mid0>
<nme>youtube-dl</nme>
<Event sr="con0" ve="2">
<code>580953799</code>
<pri>0</pri>
<Bundle sr="arg0">
<Vals sr="val">
<com.twofortyfouram.locale.intent.extra.BLURB>Command: all
Sender: all
Subject: all
Text: all
File: all</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<configcaseinsensitiveimage>false</configcaseinsensitiveimage>
<configcaseinsensitiveimage-type>java.lang.Boolean</configcaseinsensitiveimage-type>
<configcaseinsensitivesub>false</configcaseinsensitivesub>
<configcaseinsensitivesub-type>java.lang.Boolean</configcaseinsensitivesub-type>
<configcaseinsensitivetext>false</configcaseinsensitivetext>
<configcaseinsensitivetext-type>java.lang.Boolean</configcaseinsensitivetext-type>
<configcommand>&lt;null&gt;</configcommand>
<configcommand-type>java.lang.String</configcommand-type>
<configexactimage>false</configexactimage>
<configexactimage-type>java.lang.Boolean</configexactimage-type>
<configexactsub>false</configexactsub>
<configexactsub-type>java.lang.Boolean</configexactsub-type>
<configexacttext>false</configexacttext>
<configexacttext-type>java.lang.Boolean</configexacttext-type>
<configimage>&lt;null&gt;</configimage>
<configimage-type>java.lang.String</configimage-type>
<configregeximage>false</configregeximage>
<configregeximage-type>java.lang.Boolean</configregeximage-type>
<configregexsub>false</configregexsub>
<configregexsub-type>java.lang.Boolean</configregexsub-type>
<configregextext>false</configregextext>
<configregextext-type>java.lang.Boolean</configregextext-type>
<configsubject>&lt;null&gt;</configsubject>
<configsubject-type>java.lang.String</configsubject-type>
<configtext>&lt;null&gt;</configtext>
<configtext-type>java.lang.String</configtext-type>
<net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED>true</net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED>
<net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED-type>java.lang.Boolean</net.dinglisch.android.tasker.EXTRA_NSR_DEPRECATED-type>
<net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT>0</net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT>
<net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT-type>java.lang.Integer</net.dinglisch.android.tasker.extras.REQUESTED_TIMEOUT-type>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>plugininstanceid plugintypeid </net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
<plugininstanceid>5c7a3152-e670-4e50-b0d8-91c412858b38</plugininstanceid>
<plugininstanceid-type>java.lang.String</plugininstanceid-type>
<plugintypeid>com.joaomgcd.autoshare.intent.IntentReceiveShareEvent</plugintypeid>
<plugintypeid-type>java.lang.String</plugintypeid-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.joaomgcd.autoshare</Str>
<Str sr="arg2" ve="3">com.joaomgcd.autoshare.activity.ActivityConfigReceiveShareEvent</Str>
</Event>
</Profile>
<Task sr="task5">
<cdate>1576557679359</cdate>
<edate>1616439546629</edate>
<id>5</id>
<nme>youtube-dl</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>1256900802</code>
<Bundle sr="arg0">
<Vals sr="val">
<com.termux.execute.arguments>%astext</com.termux.execute.arguments>
<com.termux.execute.arguments-type>java.lang.String</com.termux.execute.arguments-type>
<com.termux.tasker.extra.EXECUTABLE>youtube-dl.sh</com.termux.tasker.extra.EXECUTABLE>
<com.termux.tasker.extra.EXECUTABLE-type>java.lang.String</com.termux.tasker.extra.EXECUTABLE-type>
<com.termux.tasker.extra.TERMINAL>false</com.termux.tasker.extra.TERMINAL>
<com.termux.tasker.extra.TERMINAL-type>java.lang.Boolean</com.termux.tasker.extra.TERMINAL-type>
<com.termux.tasker.extra.VERSION_CODE>3</com.termux.tasker.extra.VERSION_CODE>
<com.termux.tasker.extra.VERSION_CODE-type>java.lang.Integer</com.termux.tasker.extra.VERSION_CODE-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Execute ~/.termux/tasker/youtube-dl.sh %astext</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>com.termux.tasker.extra.EXECUTABLE com.termux.execute.arguments com.termux.tasker.extra.TERMINAL</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.termux.tasker</Str>
<Str sr="arg2" ve="3">com.termux.tasker.EditConfigurationActivity</Str>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>548</code>
<on>false</on>
<Str sr="arg0" ve="3">Saved: %astext</Str>
<Int sr="arg1" val="0"/>
</Action>
</Task>
</TaskerData>
#!/data/data/com.termux/files/usr/bin/dash
set -eu
set -x
. $HOME/.profile
rm -rf $PREFIX/tmp/ytdl.* && true
# exec > $HOME/.termux/tasker/ytdl.log
# exec 2>&1
readonly TEMPDIR="$(mktemp --tmpdir -d ytdl.XXXXXXX)"
trap "rm -rf $TEMPDIR && true" EXIT TERM
cd $TEMPDIR
youtube-dl --output '%(id)s.%(uploader_id)s.%(ext)s' "$@"
readonly OLDNAME=$(ls)
mv $OLDNAME video
ffmpeg -i video -c copy -map_metadata -1 -metadata "creation_time=$(date -Is -u)" -map_chapters -1 $OLDNAME
mv $OLDNAME $HOME/storage/shared/Pictures/youtube-dl/
termux-media-scan $HOME/storage/shared/Pictures/youtube-dl/$OLDNAME
rm -rf $TEMPDIR && true
<TaskerData sr="" dvi="1" tv="5.11.14">
<Task sr="task5">
<cdate>1576557679359</cdate>
<edate>1616439546629</edate>
<id>5</id>
<nme>youtube-dl</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>1256900802</code>
<Bundle sr="arg0">
<Vals sr="val">
<com.termux.execute.arguments>%astext</com.termux.execute.arguments>
<com.termux.execute.arguments-type>java.lang.String</com.termux.execute.arguments-type>
<com.termux.tasker.extra.EXECUTABLE>youtube-dl.sh</com.termux.tasker.extra.EXECUTABLE>
<com.termux.tasker.extra.EXECUTABLE-type>java.lang.String</com.termux.tasker.extra.EXECUTABLE-type>
<com.termux.tasker.extra.TERMINAL>false</com.termux.tasker.extra.TERMINAL>
<com.termux.tasker.extra.TERMINAL-type>java.lang.Boolean</com.termux.tasker.extra.TERMINAL-type>
<com.termux.tasker.extra.VERSION_CODE>3</com.termux.tasker.extra.VERSION_CODE>
<com.termux.tasker.extra.VERSION_CODE-type>java.lang.Integer</com.termux.tasker.extra.VERSION_CODE-type>
<com.twofortyfouram.locale.intent.extra.BLURB>Execute ~/.termux/tasker/youtube-dl.sh %astext</com.twofortyfouram.locale.intent.extra.BLURB>
<com.twofortyfouram.locale.intent.extra.BLURB-type>java.lang.String</com.twofortyfouram.locale.intent.extra.BLURB-type>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>com.termux.tasker.extra.EXECUTABLE com.termux.execute.arguments com.termux.tasker.extra.TERMINAL</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS>
<net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>java.lang.String</net.dinglisch.android.tasker.extras.VARIABLE_REPLACE_KEYS-type>
<net.dinglisch.android.tasker.subbundled>true</net.dinglisch.android.tasker.subbundled>
<net.dinglisch.android.tasker.subbundled-type>java.lang.Boolean</net.dinglisch.android.tasker.subbundled-type>
</Vals>
</Bundle>
<Str sr="arg1" ve="3">com.termux.tasker</Str>
<Str sr="arg2" ve="3">com.termux.tasker.EditConfigurationActivity</Str>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>548</code>
<on>false</on>
<Str sr="arg0" ve="3">Saved: %astext</Str>
<Int sr="arg1" val="0"/>
</Action>
</Task>
</TaskerData>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment