Skip to content

Commit

Permalink
- Linux only: copy aria2-remote script to binary folder as CI wouldn'…
Browse files Browse the repository at this point in the history
…t do it anymore.
  • Loading branch information
derreisende77 committed Aug 11, 2024
1 parent 1e8b103 commit fecd883
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
36 changes: 36 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,24 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>rename-file</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/scripte/aria2-remote.sh</sourceFile>
<destinationFile>${project.build.directory}/res/bin/aria2-remote.sh</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down Expand Up @@ -1006,6 +1024,24 @@
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>rename-file</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>${project.basedir}/scripte/aria2-remote.sh</sourceFile>
<destinationFile>${project.build.directory}/res/bin/aria2-remote.sh</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
69 changes: 69 additions & 0 deletions scripte/aria2-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

# Das Skript muss evtl. noch
# "ausführbar" gemacht werden!!!

# Programmparameter in MediathekView
# %f ** <URL of aria2 daemon> <secret for aria2 daemon>

# oder ohne gesetztes Passwort
# %f ** <URL of aria2 daemon>

# Start von aria2 auf dem Server
# aria2c --enable-rpc --rpc-listen-all --dir=/ZIELPFAD/FILME


log=/tmp/MediathekView-aria2.log
echo "Running $0 $*" >$log

url=$1
filename=$(basename "$2")

aria2_server_url=$3
aria2_server_secret=$4

#echo >>$log
#echo "MediathekView-aria2 parameters:" >>$log
#while [ -n "$1" ]
#do
# echo "$1" >>$log
# shift
#done

echo >>$log
echo "url: " $url >>$log
echo "filename: " $filename >>$log
echo "aria2_server_url: " $aria2_server_url >>$log
echo "aria2_server_secret: " $aria2_server_secret >>$log

id=medview
method=aria2.addUri

if [ -n "$filename" ]
then
options=",{\"out\":\"${filename}\"}"
else
options=""
fi

params="[\"token:${aria2_server_secret}\",[\"${url}\"]${options}]"
params_base64enc=$(echo "${params}" | base64 -w 0 -)
params_base64enc_urlenc=${params_base64enc//=/%3D}

get="${aria2_server_url}?id=${id}&method=${method}&params=${params_base64enc_urlenc}"

echo >>$log
echo "executing: $get" >>$log

result=$(curl -S -k "$get")

echo >>$log
echo "result: $result" >>$log

if [[ $result =~ '"result":' ]]
then
exit 0
else
exit 1
fi

0 comments on commit fecd883

Please sign in to comment.