def get_all_podcasts_from_google_music():
    '''Returns sorted list of all podcast episodes from Google as a list
  '''

    here = os.path.dirname(os.path.realpath(__file__))
    oauth_path = os.path.join(here, config['DEFAULT']['OAUTH_FILEPATH'])
    device_id = config['DEFAULT']['DEVICE_ID']
    mc = Mobileclient()
    series_title = "Fourth Official Soccer Podcast"
    google_music_url = "https://play.google.com/music/m/"

    # mc.perform_oauth() only needed once (can be avoided by providing an oauth file)
    mc.oauth_login(device_id, oauth_path)

    episodes_list = mc.get_all_podcast_episodes(device_id)
    episodes_list = [
        episode for episode in episodes_list
        if episode['seriesTitle'] == series_title
    ]
    episodes_list = sorted(episodes_list,
                           key=itemgetter('publicationTimestampMillis'))
    url_list = [
        f"{google_music_url}{episode['episodeId']}?t={episode['title']}-{episode['seriesTitle']}"
        for episode in episodes_list
    ]
    url_list = [url.replace(" ", "_") for url in url_list]
    episodes_list = [{'name': episode['title'], 'description': episode['description'], \
      'publication_timestamp_millis': episode['publicationTimestampMillis'], \
      'url': url} for episode, url in zip(episodes_list, url_list)]

    return episodes_list
def get_google_music_info():
    '''Returns podcast information of the current episode from Google
  Podcasts. The name of the episode, the release date and the description of the episode;
  all of which can be used to create the about the episode.
  '''

    here = os.path.dirname(os.path.realpath(__file__))
    oauth_path = os.path.join(here, config['DEFAULT']['OAUTH_FILEPATH'])
    device_id = config['DEFAULT']['DEVICE_ID']
    mc = Mobileclient()
    series_title = "Fourth Official Soccer Podcast"
    google_music_url = "https://play.google.com/music/m/"

    # mc.perform_oauth() only needed once (can be avoided by providing an oauth file)
    mc.oauth_login(device_id, oauth_path)

    episodes_list = mc.get_all_podcast_episodes(device_id)
    episodes_list = [
        episode for episode in episodes_list
        if episode['seriesTitle'] == series_title
    ]
    episodes_list = sorted(episodes_list,
                           key=itemgetter('publicationTimestampMillis'),
                           reverse=True)
    last_episode = episodes_list[0]
    underscored_title = last_episode['title'].replace(" ", "_")
    underscored_series_title = last_episode['seriesTitle'].replace(" ", "_")

    return {
        'name':
        last_episode['title'],
        'description':
        last_episode['description'],
        'publication_timestamp_millis':
        last_episode['publicationTimestampMillis'],
        'url':
        f"{google_music_url}{last_episode['episodeId']}?t={underscored_title}-{underscored_series_title}"
    }