Outils pour utilisateurs

Outils du site


Panneau latéral

torrents

Table des matières

Torrents

Plugins

Periscope

Periscope permet de rechercher automatiquement des sous-titres de films.

Installation :

cd /tmp
wget ppa.launchpad.net/patrick-dessalle/ppa/ubuntu/pool/main/p/python-periscope/python-periscope_0.2.5-1_all.deb
wget ppa.launchpad.net/patrick-dessalle/ppa/ubuntu/pool/main/p/python-guessit/python-guessit_0.2b1-1_all.deb
apt-get install python-beautifulsoup
dpkg -i python-guessit_0.2b1-1_all.deb
dpkg -i python-periscope_0.2.5-1_all.deb

Créer le fichier de script avec le code suivant et mettre les droits d'execution :

#!/bin/bash
 
# Configuration
videoext=('AVI' 'MKV' 'MP4' 'FLV');
language="fr"
 
# Code
 
log()     { logger -t periscope "$@"; echo "$@"; }
 
# Check if a value exists in an array
# @param $1 mixed  Needle 
# @param $2 array  Haystack
# @return  Success (0) if value exists, Failure (1) otherwise
# Usage: in_array "$needle" "${haystack[@]}"
# See: http://fvue.nl/wiki/Bash:_Check_if_array_element_exists
in_array() {
    local hay needle=$1
    shift
    for hay; do
        [[ $hay == $needle ]] && return 0
    done
    return 1
}
 
# Paramters extraction
thash=$1
fname=$2
fpath=$3
level=$4
 
level=$(( level + 1 ))
 
log "Called with parameters $thash, $fname, $fpath, recursion level=$level"
 
if (( level > 3 )); then
   log "Max recursion level reached, exiting"
   exit
fi
 
# Check if fpath is a folder or a regular file
if [ -d "$fpath/$fname" ]; then
 
   log "Folder detected, analyzing contents"
 
   find "$fpath/$fname"/* -print0 | while read -d $'\0' rFile; do
      log "Checking file or folder $rFile"
 
      # Only on handled extensions
      fext=`echo ${rFile##*.}|tr '[a-z]' '[A-Z]'`
 
      if [ -d "$rFile" ] || in_array "$fext" "${videoext[@]}" ; then
         log "Recursion on file or folder $rFile"
         rFileBase=$(basename "$rFile")
         $0 "$thash" "$rFileBase" "$fpath/$fname" "$level" &
      fi
   done
 
else
 
   fext=`echo ${fname##*.}|tr '[a-z]' '[A-Z]'`
 
   log "Extension: $fext"
 
   if in_array "$fext" "${videoext[@]}" ; then
      log "Downloading subtitle for $fpath/$fname"
      # Temporary fix for periscope issue #124
      # periscope --language=$language "$fpath/$fname"
      periscope "$fpath/$fname"
   else
      log "Skipping extension $fext"
   fi
fi
 
log "Execution terminated"
torrents.txt · Dernière modification: 2015/04/28 18:17 (modification externe)