OSDN Git Service

implement seriesnum determinant system.
[rec10/rec10-git.git] / rec10 / trunk / src / guess.py
index 0fd8b73..5e1f6ca 100644 (file)
@@ -1,3 +1,4 @@
+import os.path
 #!/usr/bin/python
 # coding: UTF-8
 # Rec10 TS Recording Tools
@@ -17,9 +18,21 @@ def detName(title,path):
     tt=detNameType(title, path)
     if tt['type']=="C"or tt['type']=="D":
         tt['num']=detNum(tt['title'],tt['folder'])
+def detSeriesNum(execpath):
+    files=os.listdir(execpath)
+    ss={}
+    for file in files:
+        ftitle=os.path.splitext(file)
+        fname=ftitle[0]
+        fname=zenhan.toHankaku(unicode(name))
+        st=detNameType(fname, execpath)['title']
+        if not len(ss[st])>0:
+            ss[st]=[]
+        ss[detNum(fname,execpath)]=ftitle
+    return ss
 def detNum(title,movepath):
     """
-        #
+        #番組の話数を推測する。
     """
     files=os.listdir(movepath)
     ff=[]
@@ -39,7 +52,7 @@ def detNum(title,movepath):
                 ff.append([p1['num'],p1['title'],time1])
                 if maxnum<p1['num']+1:
                     maxnum=p1['num']+1
-    detMultiDeltaDays(ff)
+    return detMultiDeltaDays(ff)
 def detMultiDeltaDays(num_with_title_with_dates):
     maxnum=0
     for ft in num_with_title_with_dates:
@@ -113,6 +126,7 @@ def detNameType(title,path):
     path --search reflexively
     """
     recdblist.printutf8(title)
+    title=auto_move.getTitle(title)##titleから日時を除く
     #rA=re.compile(".+(?P<title>)#\d(?P<num>)\s[0,10]\z")
     rA=re.compile("(.+)#(\d*)\s*\Z")
     tA=rA.match(title)