├── .gitignore ├── ff.sh ├── mcall.sh ├── functions.sh ├── multicut_light.rc ├── ffall.sh ├── LICENSE ├── auto.sh ├── Dockerfile ├── README.md └── README_de.md /.gitignore: -------------------------------------------------------------------------------- 1 | !/.gitignore 2 | .idea 3 | *.iml 4 | .DS_Store 5 | *.log 6 | -------------------------------------------------------------------------------- /ff.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | source functions.sh 3 | 4 | convert $1 $2 5 | -------------------------------------------------------------------------------- /mcall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source functions.sh 4 | 5 | # cut 6 | count=`ls -1 *.avi 2>/dev/null | wc -l` 7 | if [ $count != 0 ]; then 8 | for file in *.avi 9 | do 10 | mc $file 11 | done 12 | fi -------------------------------------------------------------------------------- /functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function convert { 4 | ffmpeg -i "$1" -c:v libx264 -crf 20 -preset fast -map 0:0 -map 0:1 -c:a libfaac -movflags +faststart "$2" 5 | } 6 | 7 | function mc { 8 | if [ "${renameFile}" == "true" ]; then 9 | multicut.sh -name -remote $1 10 | else 11 | multicut.sh -remote $1 12 | fi 13 | } 14 | 15 | function decode { 16 | otrdecoder -e ${otrEmail} -p ${otrPassword} -i $1 17 | } -------------------------------------------------------------------------------- /multicut_light.rc: -------------------------------------------------------------------------------- 1 | # Konfiguration 2 | moveOtrkey=1 # Otrkey nach dem dekodieren verschieben 3 | SortOrder=3 # 0: rating 1: ratingbyauthor 2: ratingcount 3: Algorithmus 4 | useSuggestedMovieName=0 # Vorgeschlagene Dateinamen benutzen 5 | useCommentsforMovieName=0 # Kommentare mit in Vorschlaege einbeziehen 6 | replaceWhitespace=0 # Im vorg. Dateinamen Leerzeichen durch Unterstriche ersetzen 7 | Auto=1 # Automatik modus 8 | Smart=1 # Zuerst Cutlists auswaehlen, danach schneiden 9 | removeEDL=1 # EDL-Datei nach dem Anzeigen löschen 10 | searchby="name" # suchen anhand von "name", oder "size" 11 | rateCutlist=0 # Bewertung nach dem Schneiden abgeben 12 | -------------------------------------------------------------------------------- /ffall.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source functions.sh 4 | 5 | CONV="converted" 6 | ORG="original" 7 | 8 | function convertAll { 9 | count=`ls -1 *.$1 2>/dev/null | wc -l` 10 | if [ $count != 0 ]; then 11 | for file in *.$1 12 | do 13 | convert "${file}" "${CONV}/${file}.m4v" 14 | mv "${file}" "${ORG}/${file}" 15 | done 16 | fi 17 | } 18 | 19 | if [ ! -d "${CONV}" ]; then 20 | mkdir "${CONV}" 21 | fi 22 | if [ ! -d "${ORG}" ]; then 23 | mkdir "${ORG}" 24 | fi 25 | 26 | 27 | count=`ls -1 *.m4v 2>/dev/null | wc -l` 28 | if [ $count != 0 ]; then 29 | for file in *.m4v 30 | do 31 | convert "${file}" "${CONV}/${file}" 32 | mv "${file}" "${ORG}/${file}" 33 | done 34 | fi 35 | 36 | convertAll "avi" 37 | convertAll "mp4" 38 | convertAll "mov" 39 | convertAll "mkv" -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Jürgen Brüster 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | source functions.sh 4 | #ffmpeg -bsf:v h264_mp4toannexb -sn -vcodec libx264 "$i.ts" 5 | 6 | 7 | # store cutlist.at url to file 8 | filename=/root/.cutlist.at 9 | if [ -a "$filename" ]; then 10 | rm "$filename" 11 | fi 12 | touch "$filename" 13 | echo ${cutlistAtUrl} >> "$filename" 14 | 15 | # decode 16 | if [ "${skipDecode}" != "true" ]; then 17 | for keyFile in /otr/*.otrkey 18 | do 19 | echo "Processing: $keyFile" 20 | decode $keyFile 21 | done 22 | else 23 | echo "decode skipped" 24 | fi 25 | 26 | # cut 27 | if [ "${skipCut}" != "true" ]; then 28 | for decodedFile in /otr/*.avi 29 | do 30 | mc $decodedFile 31 | done 32 | else 33 | echo "cut skipped" 34 | fi 35 | 36 | # convert 37 | if [ "${convert}" != "false" ] && [ "${skipConvert}" != "true" ]; then 38 | resultFileType=".m4v" 39 | for cutFile in /otr/cut/*.avi 40 | do 41 | convert "${cutFile}" "${cutFile}.m4v" 42 | done 43 | else 44 | echo "convert skipped" 45 | resultFileType=".avi" 46 | fi 47 | 48 | # cleanup (only if success) 49 | countOtr=`ls -1 *.otrkey 2>/dev/null | wc -l` 50 | countResult=`ls -1 cut/*${resultFileType} 2>/dev/null | wc -l` 51 | if [ "${skipCleanup}" != "true" ] && [ $countOtr == $countResult ] && [ `wc -c cut/*${resultFileType} | tail -n 1 | cut -c8-9` != "0" ]; then 52 | echo "cleanup" 53 | rm -f *.otrkey 54 | mv cut/*${resultFileType} ./ 55 | rm -rf cut uncut decoded 56 | elif [ "${skipCleanup}" == "true" ]; then 57 | echo "cleanup skipped, keeping intermediate files" 58 | else 59 | echo "something went wrong, keeping intermediate files" 60 | fi 61 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian/eol:wheezy 2 | 3 | MAINTAINER Juergen Bruester github@devilscab.de 4 | 5 | # add repos for avidemux 6 | RUN echo "deb http://archive.deb-multimedia.org wheezy main non-free" >> /etc/apt/sources.list 7 | RUN echo "deb http://archive.deb-multimedia.org wheezy-backports main" >> /etc/apt/sources.list 8 | RUN apt-get update \ 9 | && apt-get install -y --force-yes deb-multimedia-keyring \ 10 | && apt-get update \ 11 | && apt-get -y install curl wget dialog nano bzip2 bc avidemux-cli ffmpeg procps \ 12 | && apt-get clean \ 13 | && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* 14 | 15 | 16 | ENV otrdecoderFileName otrdecoder-bin-x86_64-unknown-linux-gnu-0.4.1133 17 | RUN curl -o otrdecoder.tar.bz2 https://www.onlinetvrecorder.com/downloads/otrdecoder-bin-x86_64-unknown-linux-gnu-0.4.1133.tar.bz2 18 | RUN tar -xf otrdecoder.tar.bz2 19 | 20 | WORKDIR ${otrdecoderFileName} 21 | RUN chmod +x otrdecoder 22 | ENV PATH $PATH:/"${otrdecoderFileName}" 23 | 24 | # install multicut 25 | RUN echo 'alias sudo=""' >> ~/.bashrc 26 | RUN mkdir /home/root 27 | RUN curl -o multicut.sh https://raw.githubusercontent.com/crushcoder/multicut_light-1/master/multicut_light.sh 28 | RUN chmod +x multicut.sh 29 | COPY multicut_light.rc /root/.multicut_light.rc 30 | 31 | RUN curl -o otrcut.sh https://raw.githubusercontent.com/m23project/otrcut.sh/master/otrcut.sh 32 | RUN chmod +x otrcut.sh 33 | 34 | # batch script 35 | COPY functions.sh auto.sh ff.sh ffall.sh mcall.sh /${otrdecoderFileName}/ 36 | COPY README_de.md README.md / 37 | RUN chmod +x functions.sh auto.sh ff.sh ffall.sh mcall.sh 38 | 39 | RUN mkdir /otr 40 | WORKDIR /otr 41 | 42 | CMD ["auto.sh"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OTR - Online-TV-Recorder Tools 2 | ## Decode, Cut, Convert otrkey files to h264 für Playstation, iPhone, iPad, MacOS, Android 3 | 4 | [Deutsche Version](README_de.md) 5 | 6 | Image containing everything to work with otrkey files from http://onlinetvrecorder.com. 7 | My target is a automatic workflow. 8 | 9 | Components: 10 | 11 | * Easydekoder 12 | * multicut_light (customized) 13 | * ffmpeg 14 | * avidemux 2.5.6 15 | * Debian Wheezy Archived 16 | 17 | ### Usage 18 | 19 | #### Batch - Decode, Cut, Convert to h264, Cleanup 20 | 21 | docker run -e "otrEmail=bla@fasel.de" -e "otrPassword=geheim" -e "cutlistAtUrl=http://cutlist.at/user/h52hm126h" -v ~/Downloads:/otr develcab/otr 22 | 23 | * You need Docker: https://www.docker.com/products/docker-toolbox#/resources 24 | * __email__: E-Mail you use to login at onlinetvrecorder.com 25 | * __password__: Password you use to login at onlinetvrecorder.com 26 | * __cutlistAtUrl__: Your personal server-url / "Persönliche Server-URL" from http://cutlist.at (You need to register there) 27 | * The folder where your otrkey files are (here: _~/Downloads_) 28 | * All otrkey files in this folder will be processed by the auto.sh script 29 | * Also temporary files will be created, and deleted, in this folder 30 | * (optional) __renameFile=true__: Rename the file to used cutlist filename 31 | * (optional) __skipConvert=true__: Only decode and cut, but don't convert to m4v 32 | * (optional) __skipDecode=true__: No decode, only subsequent steps are executed 33 | * (optional) __skipCut=true__: Don't cut movie 34 | * (optional) __skipCleanup=true__: Don't delete intermediate files 35 | 36 | 37 | #### Manuell 38 | 39 | You can also use the image directly if you don't want the automatic process. 40 | You only need to specify the folder with your otrkey files (here: _~/Downloads_) 41 | 42 | docker run -ti -v ~/Downloads:/otr develcab/otr bash 43 | 44 | You can use _otrdecoder_, _multicut.sh_, _avidemux_ und _ffmpeg_. 45 | There are also curl and wget. 46 | 47 | I wrote some more scripts: 48 | 49 | * ffall.sh - encodes all files in the current folder to h264 .m4v. Encoded files are stored in _converted_, while the source file will be moved to _original_ 50 | * mcall.sh - cuts all .avi files in current folder with multicut 51 | 52 | __Important__: If you change a setting in the image, or install new software; these changes won't be saved. 53 | After a restart of the image you start with a clean system. 54 | If you want to change something you should build your own image, using this a base one or forking it. 55 | 56 | 57 | ### Customize 58 | 59 | Fork it: https://github.com/crushcoder/otr-docker 60 | Or just download and make your own image locally: https://github.com/crushcoder/otr-docker/archive/master.zip 61 | 62 | * .multicut_light.rc - Preferences for the cutting script. E.g., if you want to be asked for the name of 63 | the cutted movie, you can override my settings for avidemux and you get the original behavior with adding the line 64 | 65 | avidemuxOptions="--force-smart" 66 | 67 | * auto.sh 68 | * That's the script used in automatic mode 69 | * The first function contains the settings for ffmpeg 70 | * In the bottom you can find the blocks of execution 71 | * For example you can delete some lines after _# cleanup_ to keep intermediate files 72 | * Dockerfile 73 | * The Dockerfile contains the installation of the whole otr system 74 | * Here you could change the cutting script or install further tools 75 | 76 | 77 | ### HowTo build the project 78 | 79 | * Required: Docker Engine or Desktop https://www.docker.com/products/docker-engine 80 | 81 | docker build -t develcab/otr . 82 | -------------------------------------------------------------------------------- /README_de.md: -------------------------------------------------------------------------------- 1 | # OTR - Online-TV-Recorder Tools 2 | ## Decode, Cut, Convert otrkey files to h264 für Playstation, iPhone, iPad, MacOS, Android 3 | 4 | [English Version](README.md) 5 | 6 | Docker Image mit allen Komponenten um otrkey Dateien von http://onlinetvrecorder.com zu bearbeiten. 7 | Ziel ist eine möglichst automatische Bearbeitung. 8 | 9 | Components: 10 | 11 | * Easydekoder 12 | * multicut_light (customized) 13 | * ffmpeg 14 | * avidemux 2.5.6 15 | * Debian Wheezy Archived 16 | 17 | ### Usage 18 | 19 | #### Batch - Decode, Cut, Convert to h264, Cleanup 20 | 21 | docker run -e "otrEmail=bla@fasel.de" -e "otrPassword=geheim" -e "cutlistAtUrl=http://cutlist.at/user/h52hm126h" -v ~/Downloads:/otr develcab/otr 22 | 23 | * Man benötigt Docker: https://www.docker.com/products/docker-toolbox#/resources 24 | * Man muss dem Programm einige Angaben mitgeben 25 | * __email__: Die E-Mail Adresse die man bei onlinetvrecorder.com zum Einloggen nutzt 26 | * __password__: Das Passwort zum Einloggen bei onlinetvrecorder.com 27 | * __cutlistAtUrl__: Die "Persönliche Server-URL" von http://cutlist.at (Nach Registrierung oben rechts im Menü) 28 | * Das Verzeichnis in dem sich die .otrkey Dateien befinden (hier: _~/Downloads_) 29 | * Das Script bearbeitet alle otrkey Dateien in diesem Verzeichnis, und legt auch hier temporäre Dateien ab 30 | * (optional) __renameFile=true__: Ändert den Namen des Files zu dem von der Cutlist 31 | * (optional) __skipConvert=true__: Es wird nur dekodiert und geschnitten, aber nicht nach m4v konvertiert 32 | * (optional) __skipDecode=true__: Nicht dekodieren, nur nachfolgende Schritte ausführen 33 | * (optional) __skipCut=true__: Nicht schneiden 34 | * (optional) __skipCleanup=true__: Temporäre Dateien nicht löschen 35 | 36 | 37 | #### Manuell 38 | 39 | Man kann das Image auch manuell benutzen wenn man zB garnicht umwandeln möchte. 40 | Hierbei muss man nur den Ordner spezifizieren in dem man arbeiten möchte (hier _~/Downloads_) 41 | 42 | docker run -ti -v ~/Downloads:/otr develcab/otr bash 43 | 44 | Man kann _otrdecoder_, _multicut.sh_, _avidemux_ und _ffmpeg_ auf der Kommandozeile nutzen. 45 | Nano, curl und wget sind auch installiert. 46 | 47 | Ganz wichtig: Änderungen die man in einem laufenden Container vornimmt (also Software installieren, Einstellungen 48 | im System vornehmen usw.) werden nicht dauerhaft gespeichert. 49 | Wenn man den Container stoppt und wieder startet sind Änderungen weg. 50 | 51 | Weitere Scripte: 52 | 53 | * ffall.sh - Kodiert alle Dateien im momentanen Ordner nach h264 m4v. 54 | * mcall.sh - Schneidet alle avi Dateien im momentanen Ordner mit multicut 55 | 56 | 57 | ### HowTo build the project 58 | 59 | * Required: Docker Engine / Desktop https://www.docker.com/products/docker-engine 60 | 61 | docker build -t develcab/otr . 62 | 63 | 64 | ### Customize 65 | 66 | * .multicut_light.rc - hier sind die Einstellungen für Multicut hinterlegt. 67 | * Wenn man zB lieber gefragt werden will wie das File nach dem Schneiden heißen soll, 68 | kann man meine Änderungen überschreiben und den Multicut Originalzustand erhalten indem man eine Zeile ergänzt: 69 | 70 | avidemuxOptions="--force-smart" 71 | 72 | * auto.sh 73 | * Dieses Skript wird im Automatischen Modus ausgeführt 74 | * Hier findet sich in der obersten convert function die Einstellungen für ffmpeg 75 | * Unten kann man die einzelnen Blöcke des Ablaufs erkennen 76 | * Man kann zB die Zeilen unter _# cleanup_ ändern wenn man die Dateien eines Zwischenschrittes behalten möchte 77 | * Dockerfile 78 | * Mit dem Dockerfile wird das Image gebaut, und das Betriebssystem und die Tools installiert. 79 | * Wenn man zB lieber ein anderes Schnitt-Script nutzen will könnte man hier den Download ergänzen 80 | --------------------------------------------------------------------------------