we have fixed the date stamp now

This commit is contained in:
dreamer 2020-10-14 12:25:52 +02:00
parent 6c4eaaa764
commit 99c1579137
3 changed files with 18 additions and 29 deletions

View File

@ -5,7 +5,7 @@ config({"development", "production"}, {
postgres = {
host = "postgres",
user = "postgres",
-- password = "the_password",
password = "the_password",
database = "postgres"
}
})

View File

@ -70,35 +70,19 @@ local function Splhandler(self)
return
end
-- we have to split the `hr:min:sec` and `month/day/year` strings from SPL
-- and since SPL uses both "." and "-" for dates .. somehow .. we have to do more dirty tricks ..
local function Split(s, delimiters)
for i, delimiter in ipairs(delimiters) do
local result = {}
if delimiter == "." then
for match in string.gmatch(s, "[^%.]+") do
table.insert(result, match)
end
else
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
end
if table.getn(result) == 3 then
return result
else
print("something is wrong: ".. s)
end
-- we have to split the `hr:min:sec` and `year-month-day` strings from SPL
local function Split(s, delimiter)
local result = {}
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match)
end
return result
end
local split_airtime = Split(airtime, {":"})
local split_airtime = Split(airtime, ":")
local airtime_hr, airtime_min, airtime_sec = split_airtime[1], split_airtime[2], split_airtime[3]
local split_airdate = Split(airdate, {"/", ".", "-"})
local split_airdate = Split(airdate, "-")
local airdate_year, airdate_month, airdate_day = split_airdate[1], split_airdate[2], split_airdate[3]
local airtime_stamp = os.time{year=airdate_year, month=airdate_month, day=airdate_day, hour=airtime_hr, min=airtime_min, sec=airtime_sec}

View File

@ -24,7 +24,12 @@ ignore_tags = [
"XLastScheduled", "EAN/UPC", "Comment", "Record Date", "XEndDate", "XRestrictions"
]
query_params = {}
host = 'http://localhost:8082'
# host = 'https://tracks.intergalactic.fm'
query_params = {
# "secret": "secret"
}
if len(sys.argv) <= 1:
sys.exit("no argument passed")
@ -60,7 +65,7 @@ for item in ape.tag.frames:
# print(Y,M,D,h,m,s)
time_list.append("{}:{}:{}".format(h, m, s))
date_list.append("{}/{}/{}".format(M, D, Y))
date_list.append("{}-{}-{}".format(Y, M, D))
elif key == "Other":
query_params["country"] = value.decode()
elif key == "Year":
@ -88,7 +93,7 @@ while i < len(time_list):
# print(query_params)
response = requests.get(
'http://localhost:8082/spl/1',
'{}/spl/1'.format(host),
params=query_params
)
# print(response)