extract only

This commit is contained in:
j 2010-12-28 19:44:48 +05:30
parent 5b93cc7022
commit d8fc7c10db
3 changed files with 40 additions and 9 deletions

View File

@ -25,17 +25,12 @@ if __name__ == '__main__':
parser.print_help()
sys.exit()
if not args or args[0] not in ('scan', 'sync', 'clean'):
parser.error('you must specify a valid action. \n\t\tknown actions are: scan, sync, clean')
actions = ('scan', 'extract', 'sync', 'clean')
if not args or args[0] not in actions:
parser.error('you must specify a valid action. \n\t\tknown actions are: %s' % ', '.join(actions))
action = args[0]
c = pandora_client.Client(opts.config)
if action == 'scan':
c.scan()
if action == 'sync':
c.sync()
if action == 'clean':
c.clean()
getattr(c, action)()

View File

@ -160,6 +160,33 @@ class Client(object):
c.execute('UPDATE file SET deleted=? WHERE path=?', (deleted, f))
conn.commit()
def extract(self):
conn, c = self._conn()
volumes = {}
for name in self._config['volumes']:
path = self._config['volumes'][name]
path = os.path.normpath(path)
volumes[name] = {}
volumes[name]['path'] = path
if os.path.exists(path):
volumes[name]['available'] = True
else:
volumes[name]['available'] = False
#profile = self.api.encodingProfile()['data']['profile']
profile = '480p'
for name in volumes:
if volumes[name]['available']:
prefix = volumes[name]['path']
files = self.files(prefix)
for f in files['files']:
filename = os.path.join(prefix, f['path'])
if 'video' in files['info'][f['oshash']] and files['info'][f['oshash']]['video']:
print filename.encode('utf-8')
i = encode(filename, self.media_cache(), profile)
def sync(self):
conn, c = self._conn()

View File

@ -26,6 +26,14 @@ def frame(video, target, position):
if fdir and not os.path.exists(fdir):
os.makedirs(fdir)
'''
#oxframe
cmd = ['oxframe', '-i', video, '-p', str(position), '-o', target]
print cmd
r = run_command(cmd)
return r == 0
'''
#mplayer
cwd = os.getcwd()
target = os.path.abspath(target)
@ -125,6 +133,7 @@ def video(video, target, profile, info):
'-vb', '%dk'%bitrate, '-g', '%d' % int(fps*2),
'-s', '%dx%d'%(width, height),
'-aspect', aspect,
'-deinterlace',
]
cmd = ['ffmpeg', '-y', '-threads', '2', '-i', video] \
+ audio_settings \