-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathyoutubeDLTools.py
More file actions
40 lines (36 loc) · 1.15 KB
/
Copy pathyoutubeDLTools.py
File metadata and controls
40 lines (36 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
#-*- coding: utf-8 -*-
from CheckFreeSpace import disk_usage
from DBDao import getConnectDB
import os
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def isCanDownload():
if disk_usage('./')[3]<=92:
return True
else:
return False
def randomDelete():
print 'starting random delete videosource'
db=getConnectDB()
cursor=db.cursor()
cursor.execute('''select DISTINCT fornumid from download_log''')
fidList=cursor.fetchall();
for j in fidList:
cursor.execute('''select videofilename from download_log where fornumid="%s" and isdelete is null ORDER BY downloaddate asc LIMIT 0,2'''%j[0])
delList=cursor.fetchall()
for i in delList:
print 'delete '+str(i[0])
try:
os.remove(str(i[0]))
except:
print '文件不存在!'
cursor.execute('update download_log set isDelete="1" where videofilename="'+str(i[0])+'"')
db.commit()
def isNewDirPath(fornumid):
if os.path.exists('/www/wwwroot/youtube.club/upload/videosource/'+fornumid):
return
else:
os.mkdir('/www/wwwroot/youtube.club/upload/videosource/'+fornumid)
return