do not hardcore tmp file path
This commit is contained in:
		
							parent
							
								
									26a8bb2495
								
							
						
					
					
						commit
						a84902e540
					
				
					 2 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -4,6 +4,6 @@ import os, random, string
 | 
				
			||||||
class Config:
 | 
					class Config:
 | 
				
			||||||
    SECRET_KEY = os.environ.get('SECRET_KEY') or \
 | 
					    SECRET_KEY = os.environ.get('SECRET_KEY') or \
 | 
				
			||||||
            ''.join(random.choices(string.ascii_letters, k=20))
 | 
					            ''.join(random.choices(string.ascii_letters, k=20))
 | 
				
			||||||
    DATA_DIR   = os.environ.get('DATA_DIR') or '/home/orange/devel/prolefeeder/tmp'
 | 
					    DATA_DIR   = os.environ.get('DATA_DIR') or os.path.join(os.path.dirname(__file__), 'tmp')
 | 
				
			||||||
    MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180
 | 
					    MAX_LENGTH = os.environ.get('MAX_LENGTH') or 180
 | 
				
			||||||
    KBITS      = os.environ.get('KBITS') or 128
 | 
					    KBITS      = os.environ.get('KBITS') or 128
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
from datetime import datetime, timedelta
 | 
					from datetime import datetime, timedelta
 | 
				
			||||||
 | 
					import os
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from config import Config
 | 
					from config import Config
 | 
				
			||||||
| 
						 | 
					@ -18,8 +19,8 @@ delta = timedelta(hours=1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
t = start
 | 
					t = start
 | 
				
			||||||
while t < end:
 | 
					while t < end:
 | 
				
			||||||
    fn = 'tmp/qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format(
 | 
					    fn = os.path.join(Config.DATA_DIR, 'qfhi-{:04d}{:02d}{:02d}-{:02d}{:02d}.mp3'.format(
 | 
				
			||||||
            t.year, t.month, t.day, t.hour, t.minute)
 | 
					            t.year, t.month, t.day, t.hour, t.minute))
 | 
				
			||||||
    print(fn)
 | 
					    print(fn)
 | 
				
			||||||
    generate_test_file(fn, delta)
 | 
					    generate_test_file(fn, delta)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue