Andreas Demmelbauer 2 роки тому
джерело
коміт
100f8ad6e8
1 змінених файлів з 6 додано та 5 видалено
  1. +6
    -5
      demotape.py

+ 6
- 5
demotape.py Переглянути файл

@@ -126,7 +126,7 @@ def download_stream(channel, dest_path):




def process_channel(channel): def process_channel(channel):
#logging.info('entered function process_channel with ' + channel['name'])
logging.info('entered function process_channel with ' + channel['name'])
while True: while True:


logging.info(timestamp() + ' checking ' + channel['name']) logging.info(timestamp() + ' checking ' + channel['name'])
@@ -159,17 +159,18 @@ def upload_video(videofile_path):
# Upload to cloud using webdav # Upload to cloud using webdav
result = os.system('curl -L -u %s -T "%s" "%s"' % (credentials, videofile_path, webdav_url)) result = os.system('curl -L -u %s -T "%s" "%s"' % (credentials, videofile_path, webdav_url))
if result == 0: # exit code if result == 0: # exit code
logging.info('Uploaded sucessfully %s to %s' % (filename, webdav_url))
delete_video(videofile_path) delete_video(videofile_path)
return True
except: except:
logging.info('Error while uploading %s to %s' % (file, webdav_url))
logging.info('Error while uploading %s to %s' % (filename, webdav_url))


def delete_video(file): def delete_video(file):
try: try:
logging.info('Deleting Video %s' % (file)) logging.info('Deleting Video %s' % (file))
os.system('rm -rf "%s"' % (file))
return True
result = os.system('rm -rf "%s"' % (file))
if result == 0: # exit code
logging.info('Deleted sucessfully {}'.format(file))
except: except:
logging.info('Error while deleting %s' % (file)) logging.info('Error while deleting %s' % (file))




Завантаження…
Відмінити
Зберегти