Skip to content

Commit

Permalink
Moving to reading location from config done
Browse files Browse the repository at this point in the history
  • Loading branch information
scottpidzarko committed Jul 27, 2016
1 parent 7a8438b commit b4d73ea
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions web_root/py/arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import sys
import tempfile
import os
import configparser
import ConfigParser

#####
# CiTR Radio Archive Access
Expand All @@ -20,7 +20,8 @@
#######

#enter the location of the the config.ini file. This default should work:
configLocation = os.normpath("/home/archiver/citrlog/config.ini")
configLocation = os.path.normpath("/home/archiver/citrlog/config.ini")


def joinMP3s(files):
#output = ##find output file name
Expand Down Expand Up @@ -66,17 +67,17 @@ def getMP3(self):

def main():
__startTime = datetime.strptime("21-5-2013 15:00:00", "%d-%m-%Y %H:%M:%S")
print __startTime
print __startTime
__endTime = datetime.strptime("21-5-2013 16:00:00", "%d-%m-%Y %H:%M:%S")
aj = ArchiveJoiner(__startTime, __endTime)
mp3 = aj.getMP3()
print "mp3 is %s" % (mp3)
print "mp3 is %s" % (mp3)

if __name__ == "__main__":
main()

def outputPSP(req, n, variables):
req.content_type = "text/html"
req.content_type = "text/html"
p = psp.PSP(req, "psp/%s.psp" % (n),variables)
p.run()

Expand All @@ -85,20 +86,20 @@ def download(req,fname):
req.sendfile("/tmp/%s.mp3" % (fname))

def download(req,startTime,endTime):
__startTime = datetime.strptime(startTime, "%d-%m-%Y %H:%M:%S")
__endTime = datetime.strptime(endTime, "%d-%m-%Y %H:%M:%S")
__startTime = datetime.strptime(startTime, "%d-%m-%Y %H:%M:%S")
__endTime = datetime.strptime(endTime, "%d-%m-%Y %H:%M:%S")

#Read the audiologbase from config.ini
settings = configparser.ConfigParser()
settings = ConfigParser.SafeConfigParser()
settings.read(configLocation)
archive = settings.get('main', 'audiologbase')

aj = ArchiveJoiner(__startTime, __endTime, archive)
mp3 = aj.getMP3()
f = os.stat(mp3)
req.set_content_length(f.st_size)
req.headers_out['Content-Disposition'] = "attachment; filename=archive.mp3"
req.sendfile(mp3)
aj = ArchiveJoiner(__startTime, __endTime, archive)
mp3 = aj.getMP3()
f = os.stat(mp3)
req.set_content_length(f.st_size)
req.headers_out['Content-Disposition'] = "attachment; filename=archive.mp3"
req.sendfile(mp3)

def archive(req,starTime,hours,minutes,seconds):
arch = ArchiveRequest(startTime, hours, minutes, seconds)
Expand Down

0 comments on commit b4d73ea

Please sign in to comment.