def make_event(podcast): with open("event_template.ics") as f: event_template = f.read() start_time = podcast.date date, time = start_time.split("T") time = int(time) + 20000 end_time = f"{date}T{time}" event = event_template.format(start_time, end_time, podcast.title) ics = f"{podcast.feed}.ics" with open(ics, "w") as f: f.write(event) file_path = f"calendar/{ics}" full_path = f"{FS_PATH}/{file_path}" copy_file(ics, full_path)
def mp3_upload(self): os.chmod(self.mp3, 0o644) file_path = f"podcasts/{self.feed}/{self.mp3_filename}" full_path = f"{FS_PATH}/{file_path}" copy_file(self.mp3, full_path) self.podtrac_url = f"{PODTRAC_BASE}/{FS}/{file_path}"
def cover_upload(self): os.chmod(self.cover, 0o644) file_path = f"images/podcasts/{self.feed}/{self.cover_filename}" full_path = f"{FS_PATH}/{file_path}" copy_file(self.cover, full_path) self.cover_url = f"https://{FS}/{file_path}"
def ensure_presets(): home = expanduser("~/.ffmpeg") makedirs(home) presets = listdir(structure.CONF_DIR,filters=(filters.no_hidden,filters.no_system,filters.fnmatch("*.ffpreset"))) for preset in presets: copy_file(src=join(structure.CONF_DIR,preset),dst=join(home,preset))