Release gdrive - Google Drive Video/Music Add-on
(2016-03-15, 13:40)dmdsoftware Wrote:
(2016-03-15, 12:17)dabinn Wrote:
(2016-03-15, 12:00)dmdsoftware Wrote: Can you PM the exact name of the video files?

I cannot access the member area (don't know why), It's OK, I post some file names here .
Code:
[Anifan][現視研][GENSHIKEN][TWDVDrip][01].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][01].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][01].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][02].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][02].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][02].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][03].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][03].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][03].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][04].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][04].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][04].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][05].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][05].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][05].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][06].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][06].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][06].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][07].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][07].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][07].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][08].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][08].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][08].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][09].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][09].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][09].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][10].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][10].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][10].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][11].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][11].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][11].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][12].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][12].idx
[Anifan][現視研][GENSHIKEN][TWDVDrip][12].sub
[Anifan][現視研][GENSHIKEN][TWDVDrip][OP].avi
[Anifan][現視研][GENSHIKEN][TWDVDrip][sub].rar
[現視研.OVA].[X2][Genshiken_OVA][01][DVDRIP][BIG5][XVID].ass
[現視研.OVA].[X2][Genshiken_OVA][01][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][02][DVDRIP][BIG5][XVID].ass
[現視研.OVA].[X2][Genshiken_OVA][02][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][03][DVDRIP][BIG5][XVID].ass
[現視研.OVA].[X2][Genshiken_OVA][03][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][DVDRIP][BIG5][FONTS].rar
[現視研.OVA].[X2][Genshiken_OVA][NCED][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][NCOP][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][vol2_sp][DVDRIP][BIG5][XVID].avi
[現視研.OVA].[X2][Genshiken_OVA][vol3_sp][DVDRIP][BIG5][XVID].avi


OK, thx, I will replicate a folder using the same names and debug. There is a failsafe that should prompt you to select 1 subtitle track if it believes there are more than 4 to select from.


I didn't see the prompt, I'll check it too.

--
edit:

I checked the code of 0.7.46, and fix the major subtitle issue.(not perfect)
* file.decode('unicode-escape') is removed.
This converts the unicode with \uXXXX format to unicode char. But I didn't see this is necessary? (I think the \uXXXX format only exists in json data, and they have already converted in Python string?)
If I didn't remove this, Windows cache path and Chinese filename would not be load correctly.
* Use title.startswith() to match title name : more accurate.
* Move 'isExactMatch = False' into loop : fix 'too many subtitle loaded' issue
* Add idx extension support: idx and sub files are a pair, idx is index file, sub contains bitmap subtitle. They need to work together.

Code:
diff --git a/default.py b/default.py
index 87151ff..25645b5 100644
--- a/default.py
+++ b/default.py
@@ -1000,7 +1000,7 @@ elif mode == 'audio' or mode == 'video' or mode == 'search' or mode == 'play' or
             for file in files:
                 if file != '':
                     try:
-                        file = file.decode('unicode-escape')
+                        #file = file.decode('unicode-escape')
                         file = file.encode('utf-8')
                     except:
                         pass
@@ -1363,7 +1363,7 @@ elif mode == 'audio' or mode == 'video' or mode == 'search' or mode == 'play' or
                 for file in files:
                     if file != '':
                         try:
-                            file = file.decode('unicode-escape')
+                            #file = file.decode('unicode-escape')
                             file = file.encode('utf-8')
                         except:
                             pass
diff --git a/resources/lib/gdrive_api2.py b/resources/lib/gdrive_api2.py
index 15e88cf..237b004 100644
--- a/resources/lib/gdrive_api2.py
+++ b/resources/lib/gdrive_api2.py
@@ -851,7 +851,6 @@ class gdrive(cloudservice):

             # parsing page for videos
             # video-entry
-            isExactMatch = False
             for r2 in re.finditer('\"items\"\:\s+\[[^\{]+(\{.*?)\}\s+\]\s+\}' ,response_data, re.DOTALL):
              entryS = r2.group(1)
              for r1 in re.finditer('\{(.*?)\"appDataContents\"\:' ,entryS, re.DOTALL):
@@ -862,11 +861,12 @@ class gdrive(cloudservice):
                 title = ''
                 url = ''
                 fileExtension = ''
+                isExactMatch = False
                 for r in re.finditer('\"fileExtension\"\:\s+\"([^\"]+)\"' ,
                              entry, re.DOTALL):
                   fileExtension = r.group(1)
                   break
-                if fileExtension.lower() in ('srt','sub','ass','ssa'):
+                if fileExtension.lower() in ('srt','idx','sub','ass','ssa'):

                     for r in re.finditer('\"id\"\:\s+\"([^\"]+)\"' ,
                              entry, re.DOTALL):
@@ -875,7 +875,7 @@ class gdrive(cloudservice):
                     for r in re.finditer('\"title\"\:\s+\"([^\"]+)\"' ,
                              entry, re.DOTALL):
                         title = r.group(1)
-                        if os.path.splitext(package.file.title)[0] in title:
+                        if title.startswith(os.path.splitext(package.file.title)[0]) :
                             isExactMatch = True
                         break
                     for r in re.finditer('\"downloadUrl\"\:\s+\"([^\"]+)\"' ,

I saw the failsafe prompt this time, when I was playing the file :[現視研.OVA].[X2][Genshiken_OVA][vol2_sp][DVDRIP][BIG5][XVID].avi
This file uses no subtitle so I choose 'cancel' in the dialog, a (wrong) subtitle file is loaded.(I believe that the first or last item in srtCandidates[].)
The behavior may need to change, because in some situation like this we don't really need a subtitle for the file.
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-15, 13:50
Logout Mark Read Team Forum Stats Members Help
gdrive - Google Drive Video/Music Add-on12