abbi031892 / periscope

Automatically exported from code.google.com/p/periscope
0 stars 0 forks source link

File is too small #111

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Scanning movie folder.

What is the expected output? 
I expected it to find at least a few subtitles as it does for TV-shows (it does 
work for TV-shows, NOT for Movies), for some reason it’s unable to find any 
subs for Movies and I’m 100% sure they are available on the subtitle resource 
sites! (checked them before scanning)

What do you see instead?
ERROR:periscope.plugins.SubtitleDatabase:File is too small
writing 0 items to queue (on every subtitle resource site)

What version of the product are you using? On what operating system?
latest SVN (150) on a Synology NAS (DS211)

Please provide any additional information below.
Debug output: https://pastee.org/nmget

Original issue reported on code.google.com by schumi2...@gmail.com on 2 Aug 2011 at 6:29

GoogleCodeExporter commented 8 years ago
A couple of issues with what you're doing there:
- you're searching for subtitles on subtitles file (*.srt). The code you're 
using is querying periscope for every file while it should skip non-video 
files. The "file too small" error more than probably comes from there. The 
OpenSubtitles code doesn't even try to search subtitles for files that are too 
small and are more than probably not video files.

- you're searching subtitles for files that already have subtitles, this is the 
kind of behaviour that got periscope kicked out of BierDopje once because too 
many queries were issued. And it will happen again in the future.

Could you provide me with the source of your file (I suppose it comes from 
Tweakers.nl) so that I can try to convince the original author of that code to 
write a more sane version of it (don't search again if you already have 
subtitles, don't search on anything that is not a video)

Original comment by patrick....@gmail.com on 2 Aug 2011 at 8:38

GoogleCodeExporter commented 8 years ago
Why it's searching on srt files i can't say, according this tutorial it should 
skip them.

http://synology.brickman.nl/syn_howto/HowTo%20-%20install%20Periscope.txt
# 2011-01-13:
# - downloadSub.py modified so its skips the language if a subtitle is present.

http://dl.dropbox.com/u/5653370/periscope/downloadSub.py

downloadSub.py code:
#!/opt/bin/python2.6
# -*- coding: utf-8 -*-

import periscope
import sys
import logging
import os
import os.path
import string
logging.basicConfig(level=logging.DEBUG)

subdl = 
periscope.Periscope(cache_folder="/volume1/@appstore/periscope/periscope/cache")
filepath = sys.argv[1]
path, file = os.path.split(filepath)
filepath2 = path + "/" + file.lower()
file, ext = os.path.splitext(file)
sub_en = path + "/" + file + ".en.srt"
sub_nl = path + "/" + file + ".nl.srt"

# English subtitles
print "\nSearch for English subtitle:"
print "===================================="
if not (os.path.isfile (sub_en)) :
    subtitle1 = subdl.downloadSubtitle(filepath, ['en'])    # English
    if subtitle1 :
        print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle1['plugin'], subtitle1['lang'], subtitle1['subtitlepath'])
        os.rename(subtitle1['subtitlepath'], string.join(string.split(subtitle1['subtitlepath'], ".srt"), ".en.srt"))
    if subtitle1 == None :
        subtitle3 = subdl.downloadSubtitle(file + ".srt", ['en'])
        if subtitle3 :
            print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle3['plugin'], subtitle3['lang'], subtitle3['subtitlepath'])
            os.rename(subtitle3['subtitlepath'], path + "/" + file + ".en.srt")
else:
    print "English subtitle present for %s" % filepath

# Dutch subtitles
print "\nSearch for Dutch subtitle:"
print "===================================="
if not (os.path.isfile (sub_nl)) :
    subtitle2 = subdl.downloadSubtitle(filepath, ['nl'])    # Dutch
    if subtitle2 :
        print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle2['plugin'], subtitle2['lang'], subtitle2['subtitlepath'])
        os.rename(subtitle2['subtitlepath'], string.join(string.split(subtitle2['subtitlepath'], ".srt"), ".nl.srt"))
    if subtitle2 == None :
        subtitle4 = subdl.downloadSubtitle(file + ".srt", ['nl'])
        if subtitle4 :
            print "Found a sub from %s in language %s, downloaded to %s" % ( subtitle4['plugin'], subtitle4['lang'], subtitle4['subtitlepath'])
            os.rename(subtitle4['subtitlepath'],  path + "/" + file + ".nl.srt")
else:
    print "Dutch subtitle present for %s" % filepath

I also use scanSeries.sh. code below:
#!/bin/sh
#------------------------------------------
# scanSeries
#
# use this script to search for subtitles
#
# Author: J. van Emden (Brickman)
# Latest version: http://dl.dropbox.com/u/5653370/synology.html
#
# Location: /volume1/@appstore/periscope/
#
#------------------------------------------

DIR="/volume1/homes/video/Series/";
AGE="14";

echo "============================================================="
echo -n `/bin/date`
echo ": Starting subtitle search"

find $DIR \( -name "*.avi" -o -name "*.mkv" \) -mtime -$AGE -type f -exec 
/opt/bin/python2.6 /volume1/@appstore/periscope/periscope/downloadSub.py {} \;

echo "\n"
echo -n `/bin/date`
echo ": Subtitle search ended"
echo "=============================================================\n\n"

Let me know if you need more info.

Original comment by schumi2...@gmail.com on 2 Aug 2011 at 8:56

GoogleCodeExporter commented 8 years ago
Some extra info.

Why i don't know why it's picking *.srt to check on is because of this.

I'm doing my subtitle search test like this

python2.6 /volume1/@appstore/periscope/periscope/downloadSub.py  
/volume1/Movies/2012.2009.720p.BluRay.x264-METiS/m-2012-720p.mkv 

I'm sending a specific *.mkv file to check subs for, straight after it a File 
is too small error returns.
It shouldn't even try to search on *.srt files as i'm sending the movie file 
itself.

Original comment by schumi2...@gmail.com on 2 Aug 2011 at 10:22