def _main(input_location, output_location, loose_matches=False): input_location = pathlib.Path(input_location) output_location = pathlib.Path(output_location) if ENRICHED: t = Panel(f"\t[white]Sort From:[bright white]\t\t{input_location}\n" f"\t[white]Sort To: [bright white]\t\t{output_location}") t.title = "[blue]Sort TV" t.border_style = "bold blue" t.title_align = "center" print(t) else: print( "#########################################################################" ) print( "## Sort TV ##" ) print( "#########################################################################" ) print("## Sort TV from: {}".format(input_location)) print("## Sort TV to: {}".format(output_location)) dirs = MakeList(output_location) if len(dirs) == 0: raise IOError("No output folders detected") output = SortFiles(dirs, input_location, loose=loose_matches) if ENRICHED: t = Panel(f"\t [white]Directories: [light-grey]\t\t{len(dirs):>4}\n" f"\t [white]Files Found: [grey]\t\t{len(output[0]):>4}\n" f"[bold white]\t Files Sorted:\t\t[red]{output[1]:>4}") t.title = "[blue]Sort Complete" t.border_style = "bold blue" t.title_align = "center" print(t) t = Padding("", (0, 0), style="on green", expand=True) print(t) else: print(f"## Directories: {len(dirs):>4}") print(f"## Files found: {len(output[0]):>4}") print(f"## Files sorted: {output[1]:>4}") print( "#########################################################################" )
def create_weather_panel(self) -> Panel: """ Take in WeatherAPIData instances and chosen forecast index. Return rich Panel with weather info. """ temp_colored = color_by_temperature(self.temperature) feels_colored = color_by_temperature(self.feels_like) wind_cardinal = wind_degrees_to_direction(self.wind_dir) lat = self.latitude lon = self.longitude panel_text = (f"{temp_colored} with {self.description.title()}\n" f"Feels like {feels_colored}\n" f"{wind_cardinal} @ [cyan]{self.wind_speed}mph[/]\n" f"Humidity @ [cyan]{self.humidity}%[/]\n") # Forecast weather panel. ---------------------------------------------- if self.forecast_index > 0: panel_text += f"{show_temp_difference(weather_now.temperature, self.temperature)}\n" panel = Panel(panel_text, box=box.ASCII) panel.title = f"[yellow]{self.forecast_index * 3} Hours[/]" return panel # Current weather panel. ----------------------------------------------- elif self.forecast_index == 0: if self.population != 0: panel_text += f"\n[i]Population: {self.population:,}[/]" panel_text += f"[i]\nGPS: [link=https://www.google.com/maps/@{lat},{lon}]{lat}, {lon}[/link][/]" panel = Panel(panel_text, box=box.DOUBLE) state_code = determine_state_code(city_list_filepath, self.id) if state_code: panel.title = f"[yellow]{self.city_name}, {state_code}, {self.country}[/]" else: panel.title = f"[yellow]{self.city_name}, {self.country}[/]" return panel