Esempio n. 1
0
def get_sub(id, sub_url, filename):
  r = {}
  if id == 'unacs':
    try:
      r=unacs.get_sub(id, sub_url, filename)
    except:
      update(id, 'exception', sub_url, sys.exc_info())
    else:
      update(r.get('fname','empty'), 'subs_download', sub_url)

  else:
    try:
      r=subs_sab.get_sub(id, sub_url, filename)
    except:
      update(id, 'exception',sub_url, sys.exc_info())
    else:
      update(r.get('fname','empty'), 'subs_download', sub_url)
  return r
Esempio n. 2
0
def get_sub(id, sub_url, filename):
  r = {}
  if id == 'unacs':
    try:
      r=unacs.get_sub(id, sub_url, filename)
    except:
      update(id, 'exception', sub_url, sys.exc_info())
    else:
      update(r.get('fname','empty'), 'subs_download', sub_url)

  else:
    try:
      r=subs_sab.get_sub(id, sub_url, filename)
    except:
      update(id, 'exception',sub_url, sys.exc_info())
    else:
      update(r.get('fname','empty'), 'subs_download', sub_url)
  return r
Esempio n. 3
0
def get_sub(id, sub_url, filename):
    r = {}
    if id == "unacs":
        try:
            r = unacs.get_sub(id, sub_url, filename)
        except:
            update(id, "exception", sub_url, sys.exc_info())
        else:
            update(r.get("fname", "empty"), "subs_download", sub_url)

    else:
        try:
            r = subs_sab.get_sub(id, sub_url, filename)
        except:
            update(id, "exception", sub_url, sys.exc_info())
        else:
            update(r.get("fname", "empty"), "subs_download", sub_url)
    return r
Esempio n. 4
0
def get_sub(id, sub_url, filename):
  r = {}
  if id == 'unacs':
    try:
      r=unacs.get_sub(id, sub_url, filename)
    except:
      (id, 'exception', sub_url, sys.exc_info())
    else:
      (r.get('fname','empty'), 'subs_download', sub_url)
  elif id == 'yavka':
    try:
      r=yavka.get_sub(id, sub_url, filename)
    except:
      (id, 'exception', sub_url, sys.exc_info())
    else:
      (r.get('fname','empty'), 'subs_download', sub_url)
  elif id == 'bukvi':
    try:
      r=bukvi.get_sub(id, sub_url, filename)
    except:
      (id, 'exception', sub_url, sys.exc_info())
    else:
      (r.get('fname','empty'), 'subs_download', sub_url)
  elif id == 'easternspirit':
    try:
      r=easternspirit.get_sub(id, sub_url, filename)
    except:
      (id, 'exception', sub_url, sys.exc_info())
    else:
      (r.get('fname','empty'), 'subs_download', sub_url)    
  else:
    try:
      r=subs_sab.get_sub(id, sub_url, filename)
    except:
      (id, 'exception',sub_url, sys.exc_info())
    else:
      (r.get('fname','empty'), 'subs_download', sub_url)
  return r
Esempio n. 5
0
def get_sub(id, sub_url, filename):
  if id == 'unacs':
    r=unacs.get_sub(id, sub_url, filename)
  else:
    r=subs_sab.get_sub(id, sub_url, filename)
  return r
Esempio n. 6
0
  item ={'m':'',
         'title':'',
         'year':'',
         'file_original_path':''
        }

  if cnt == 3:
    item['year'] = sys.argv[2]
  elif cnt == 1:
    sys.exit(1)
  item['title'] = sys.argv[1]

  l = unacs.read_sub(item)
  l += subs_sab.read_sub(item)

  tmp =''
  for ll in l:
    tmp = tmp + get_info(ll)+'>>>>'+'\n'

  savetofile(tmp, 'out.txt')

  log_my(l[-1]['url'])

  if l[-1]['id'] == 'unacs':
    r=unacs.get_sub(None, l[-1]['url'], None)
  else:
    r=subs_sab.get_sub(None, l[-1]['url'], None)
  if (r.has_key('data') and r.has_key('fname')):
    print r['data'][:4]
    savetofile(r['data'], r['fname'])
  sys.exit(0)