Release gdrive - Google Drive Video/Music Add-on
(2016-03-12, 15:55)dmdsoftware Wrote:
(2016-03-12, 10:10)dabinn Wrote:
(2016-03-11, 14:23)dmdsoftware Wrote: To activate the debugger, you can add the following two lines to your settings.xml

<setting id="remote_debugger" value="true" />
<setting id="remote_debugger_host" value="localhost" />

Hi,
I am still testing and tracing the code, some foundings here:
* The sub/ass loading freeze issue
I fount this is not cause by ass file type, but the amount of subtitle files in the same directory.
In function cache.setSRT(), file title did not pass to service.getSRT(). So that the service.getSRT() always returns all the subtitle file, no mater their filename matches the video file or not. (Is this by design?)
If cachePath was not set, each subttile file url will cause a 10 second timeout(approx.) to load.
(each generate an error message like :
14:22:30 T:7224 ERROR: CCurlFile::Stat - Failed: Timeout was reached(28) for https://doc-14-c4-docs.googleusercontent...34rgexxxxx...)
For example, a directory with TV series EP01~15, there will be 15 subtitles read, and takes 150 seconds waiting timeout.

* Wrong subtitle
When I test with cachePath set, wrong subtitle is displayed when playing TV series.

* Chinese subtitle filename massed up
In default.py, after 'files = cache.getSRT(service)'
file = file.decode('unicode-escape')
file = file.encode('utf-8')
These causes Chinese subtitle filename unable to load.


-------------
Update:
I have successfully fixed the subtitle issue by passing the title string to service.getSRT() and querying "title contains 'xxxx'" in google api.
All subtitles are displayed correctly, but I need more test to ensure there is no side effect.

I don't know how to commit code, so I paste the code I modified here:
In default.py:
Code:
cache.setSRT(service, title)
In cache.py
Code:
def setSRT(self, service, title):
....
srt = service.getSRT(title, self.package.folder.id)
...
srt = service.getSRT(title, self.package.folder.id)

In gdrive_api2.py
Code:
def getSRT(self, title, folderid):
...
        q='';
        # search in directory
        if folderid != False:
            q = q + "'"+str(folderid)+"' in parents"

        # search for title
        if title != False:
            title = os.path.splitext(title)[0]
            encodedTitle = re.sub(' ', '+', title)
            #url = url + "?q=title+contains+'" + str(encodedTitle) + "'"
            q = q + " and title contains '"+title+"'"

        url = url + "?" + urllib.urlencode({'q':q})

It sounds like you have the load srt from same directory enabled in the settings. It was meant to search and load subtitles when the user doesn't have the title of the SRT the same name as the video.

So I need to rethink things a bit.

There are the following situations that need to be satisfied:

1) videofile.mp4 with videofile.*.srt (1 video per directory)
2) videofile.mp4 with language.srt (1 video per directory)
3) videofile.series.mp4 with videofile.series.*.srt (multiple videos)
4) videofile.series.mp4 with language.series.*.srt (multiple videos)
5) videofile.mp4 with videofile.*.srt in a different directory

The current solution works 1,2,3,5 but you need to toggle a setting (switch between 1/3/5 and 2) otherwise 3 and 4 will cause severe issues. Your solution will work with 1 and 3.

I think I really need a solution similar to yours that will drop the need for the user to toggle a setting to change the behaviour.

1. search all srt in the directory then sub-search for title.*.srt, if match, load
2. if no match in 1, and there is only 1 srt, load
3. if no match in 1 but there are multiple srt, user prompt to select
4. if no srt returned in 1, research all srt with title across account, if match, load

I think that will handle 1)-5) situations. Thoughts?

The reason for the decoding was unicode characters would appear as squares.

edit:
I realize now that I somehow dropped the logic that switches between the search for title vs search for all srt in folder (setting: srt_folder). I don't know how that happened.

In my experience, most video player handle subtitle file like 1) and 3)
1) videofile.mp4 with videofile.*.srt (1 video per directory)
3) videofile.series.mp4 with videofile.series.*.srt (multiple videos)
and they may additionally provide an ability to select any subtitle from any directory.

I think your 1~4 step is very good. I may consider not to search title across account, although it is fast with google API in my test( maybe they have built index or something). But I am still afraid if user had lots lots of file in google drive, it may takes too long time to wait for response. Searching in a user specified str_folder should be safer.
Reply


Messages In This Thread
u - by Kraevin - 2015-05-13, 17:37
RE: [RELEASE] gdrive - Google Drive Video/Music Add-on - by dabinn - 2016-03-12, 20:07
Logout Mark Read Team Forum Stats Members Help
gdrive - Google Drive Video/Music Add-on12