|
Humble Request A program to cross reference a list of days/times and to download files from a site that uses a specific naming format for days/times, as well as to rename the first four letters to a set of characters defined in the initial list. Problem: WZBC, a college station near me, archives their shows using the following format: http://zbconline.com/wzbc-2019-MM-DD-HH-00.mp3 I've been manually downloading and renaming the shows I like to listen to (oftentimes the timing doesn't really line up with, say, me being at work, etc), and while this is fine, it's relatively time consuming. Description and requirements: So the idea is this: a program that looks to a text file for five pieces of data: Day of Week, Start Time, End Time, Lookback and Name, for as many entries as are present. The Day of the week should be converted to the actual date format (MM-DD), and the program should look back Lookback number of days, downloading the file and formatting it after the fact by adding the Name where "wzbc" normally exists. The Start/End times would tell the program how many files to rename using the Name. So this might play out with a text file that looks like this, with a pipe delimiter: M|8|10|IR or MON|0800|1000|IR (since this wouldn't require you to format the times) ...which for this week, would pull http://zbconline.com/wzbc-2019-04-29-08-00.mp3 http://zbconline.com/wzbc-2019-04-29-09-00.mp3 and rename the files: IR-2019-04-29-08-00.mp3 IR-2019-04-29-09-00.mp3 ...once they have downloaded. Nice to have features: I'm really flexible on how this works out. I've tried to explain it in what seems to be the easiest method of accomplishing the goal, though I'm sure there are prettier ways to do it. If you can figure out a way to cross reference the schedule for the station (found at https://spinitron.com/WZBC/calendar), that's great, but I feel like that makes this a much larger endeavor. I don't need anything fancy; I just take the files and shove them into folders for their respective shows, and this would save me 15-20 minutes a week of relatively monotonous work. I'd prefer that it run in Windows, but I have a Mac laptop hanging around too, in case you have a preference. Thanks in advance (even if you're just reading this).
|
# ¿ Apr 29, 2019 17:23 |
|
|
# ¿ Apr 19, 2024 09:29 |
|
Chunjee posted:I poked around on their site and didn't see an RSS feed. What gives. That would have negated the need for this as any podcast tool would fit perfectly. Ah well. I'm fairly certain it's the latter case, as each file has a two-three minute buffer from the last time period (so the 1pm file will pick up at 12:58, even though the 12pm file already has that). Couldn't say for certain, though - I'm honestly not sure how any of that backend stuff works. (Frankly, I'm at the level where I was quite pleased with myself for determining the way they store the shows in the first place. Some shows were offering "mixtapes" for a week or so, which were just that week's airing, but it's not everything, and sometimes it's just nice to be able to listen to That Weird Ambient Noise Show That's On For Three Hours, but Starts at 11pm during the workday.) Also, re: the lack of RSS feed: it's a college station, and the actual schedule itself is new as of a year or so ago. It used to just be a page they'd manually update. I think they just kinda lack resources for keeping this poo poo up (and as a person who went to a State school and worked for the paper, I totally get it - if I were to guess, they have the one CS major who also likes radio doing most of the grunt work). George RR Fartin fucked around with this message at 18:24 on Apr 29, 2019 |
# ¿ Apr 29, 2019 18:19 |
|
Yeah, the more I think of it, the more kinda difficult this all becomes. I think it's just hard for me to wrap my head around where certain more abstracted things would come from - like: if I say MONDAY is the day I care about, I can check a calendar for the last X mondays within a range, which also requires me to be aware of where we are in the month so I can pop back a month (or more) if need be. So that's a whole thing, just to find the month and date. The rest is somewhat easier in terms of formatting the link, since we'd just sort of do a while loop from the start time to the end time, but that date is the real sticky bit. My idea of an individual text file is purely out of my own familiarity with how that sort of thing works. That is: you read the text file until a specific delimiter, save that as variable DAY, read until the next delimiter, save that as START, next END, next NAME, then have a predetermined end-of-line character just to populate everything so the above algorithm can be applied. Once the downloading and renaming is done, check to see if there's another line and do it all over again if there is. I'm sure there's probably an easier way (even like, simple input might not be bad: just ask for each value, process everything, and return to asking each value once the process is done downloading). It's absolutely not set in stone. I feel like I'm asking for a sort of big pain in the butt here, so if that's at all the case, please don't worry yourself too much with it. I'm also totally open for this batch file idea if that's just far less of a pain. I can just edit in date/time ranges if that makes more sense (and since only the former is likely to change all that often, it wouldn't even be that time intensive).
|
# ¿ Apr 30, 2019 16:20 |
|
Flipperwaldt posted:I just want to inform anyone working on this that you can easily scrape the list of files that are actually available from http://zbconline.com/. You just have to change the file extension from m3u to mp3. Looks like the archive only ever goes back two weeks (ie. stuff not listed on the page apparently isn't available anymore). poo poo, I forgot about the two week window - I've been doing this manually weekly, but I remember being curious and trying further back and getting nothing. So you could just hardcode how far back to go, and not redownload any duplicates. Thanks for looking into this, everyone. I realize it's sort of the equivalent of just showing up at a stranger's house and asking them to make you a pie.
|
# ¿ Apr 30, 2019 19:33 |
|
TheLastManStanding posted:Let me know if it works It works! The first time I ran it, I got a popup that kinda sat around doing nothing. Upon closing this, I got the progress bar, but it didn't fit the window. It downloaded all instances of Infernal Racket (the only show I put in for testing), renaming the files and sticking them in the named folder appropriately. So I added another show, and ran the file again. This time, only the one popup appeared, and it worked swimmingly. I'm not sure what would account for the issue in the initial run, but it could be related to my work PC being older than dirt and using Win7. Even with the minor initial UI issue, everything else works perfectly. Thanks for putting this together! EDIT: I have a total of 15 shows on the list, ran the program, and it did everything it needed to do. No weird UI stuff, either, so that had to have just been a fluke. Figured I'd update with that so you knew it could do a good deal of work if it has to without running into issues. George RR Fartin fucked around with this message at 15:56 on May 2, 2019 |
# ¿ May 2, 2019 15:27 |