### Start mygpo Development Server Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Starts the Django development server for mygpo, making the application accessible locally on the default port. This command uses the configured development environment variables to run the server. ```bash envdir envs/dev python manage.py runserver ``` -------------------------------- ### Clone mygpo Repository Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Clones the mygpo project repository from GitHub to the local machine and changes the current directory into the newly cloned repository, initiating the setup process. ```bash git clone git://github.com/gpodder/mygpo.git cd mygpo ``` -------------------------------- ### Start mygpo Development Server for External Access Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Starts the Django development server for mygpo, binding it to all available network interfaces (`0.0.0.0`) on port 8000, allowing access from other devices on the network. Users should exercise caution when exposing the server. ```bash envdir envs/dev python manage.py runserver 0.0.0.0:8000 ``` -------------------------------- ### Configure mygpo Development Environment Variables via make Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Automates the setup of mygpo's development configuration by running a `make` command, which creates and populates environment variable files for essential Django settings, streamlining the setup process. ```bash make dev-config ``` -------------------------------- ### Set Up Python Virtual Environment and Install Local Dependencies Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Creates a Python virtual environment, activates it, and installs project-specific Python dependencies from various `requirements.txt` files for development, documentation, production, and testing purposes. ```bash virtualenv venv source venv/bin/activate pip install -r requirements.txt pip install -r requirements-dev.txt # for local development pip install -r requirements-doc.txt # for building docs pip install -r requirements-setup.txt # for a productive setup pip install -r requirements-test.txt # for running tests ``` -------------------------------- ### Install mygpo System Dependencies (Debian/Ubuntu via make) Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Installs system-level dependencies for mygpo on Debian/Ubuntu based systems using a `make` command, simplifying the installation process by leveraging predefined build rules. ```bash make install-deps ``` -------------------------------- ### Install mygpo System Dependencies (Debian/Ubuntu via apt-get) Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Manually installs system-level dependencies for mygpo on Debian/Ubuntu based systems using `apt-get`, including development libraries for PostgreSQL, JPEG, Zlib, WebP, Python, and essential build tools. ```bash sudo apt-get install libpq-dev libjpeg-dev zlib1g-dev libwebp-dev \ build-essential python3-dev virtualenv libffi-dev redis postgresql ``` -------------------------------- ### Example Response: Get User Favorite Episodes Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/favorites.rst An example JSON response showing the structure of favorite episode data returned by the /api/2/favorites/(username).json endpoint. ```http HTTP/1.1 200 OK [ { "title": "TWiT 245: No Hitler For You", "url": "http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3", "podcast_title": "this WEEK in TECH - MP3 Edition", "podcast_url": "http://leo.am/podcasts/twit", "description": "[...]", "website": "http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3", "released": "2010-12-25T00:30:00", "mygpo_link": "http://gpodder.net/episode/1046492" } ] ``` -------------------------------- ### Example HTTP Response for Subscription Changes API (No Changes) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/subscriptions.rst An example JSON response from the /api/2/subscriptions endpoint when no subscription changes have occurred, showing empty 'add' and 'remove' lists and a timestamp. ```HTTP { "add": [], "remove": [], "timestamp": 12347 } ``` -------------------------------- ### Initialize mygpo Database Migrations Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Applies pending database migrations for the mygpo project using Django's `manage.py migrate` command, ensuring the database schema is up-to-date with the application's models. This command requires the development environment variables to be loaded. ```bash envdir envs/dev python manage.py migrate ``` -------------------------------- ### Configure mygpo Development Environment Variables Manually Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Sets up a development configuration by creating an `envs/dev` directory and populating it with environment variable files for Django's email backend, secret key, database URL, debug mode, internal IPs, and media root. ```bash mkdir -p envs/dev echo django.core.mail.backends.console.EmailBackend > envs/dev/EMAIL_BACKEND echo secret > envs/dev/SECRET_KEY echo postgres://mygpo:mygpo@localhost/mygpo > envs/dev/DATABASE_URL echo True > envs/dev/DEBUG echo "127.0.0.1" > envs/dev/INTERNAL_IPS mkdir -p /tmp/mygpo-test-media echo /tmp/mygpo-test-media > envs/dev/MEDIA_ROOT ``` -------------------------------- ### Example Podcast Object Structure (JSON) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/directory.rst Illustrates the typical fields and their values for a podcast object returned by the gPodder.net API, including metadata like website, description, title, author, URL, subscriber count, and logo URL. ```JSON { "website": "http://syndication.mediafly.com/redirect/show/d581e9b773784df7a56f37e1138c037c", "description": "We're not talking dentistry here; FLOSS all about Free Libre Open Source Software. Join hosts Randal Schwartz and Leo Laporte every Saturday as they talk with the most interesting and important people in the Open Source and Free Software community.", "title": "FLOSS Weekly Video (large)", "author": "Leo Laporte", "url": "http://feeds.twit.tv/floss_video_large", "position_last_week": 0, "subscribers": 50, "mygpo_link": "http://www.gpodder.net/podcast/31991", "logo_url": "http://static.mediafly.com/publisher/images/06cecab60c784f9d9866f5dcb73227c3/icon-150x150.png" } ``` -------------------------------- ### Run mygpo Feed Downloader Commands Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Executes various forms of the `feed-downloader` Django management command to process and update podcast feeds. This includes options for specific URLs, limiting updates, random updates, toplist-based updates, and updating new feeds. ```bash envdir envs/dev python manage.py feed-downloader envdir envs/dev python manage.py feed-downloader [...] envdir envs/dev python manage.py feed-downloader --max envdir envs/dev python manage.2py feed-downloader --random --max envdir envs/dev python manage.py feed-downloader --toplist --max envdir envs/dev python manage.py feed-downloader --update-new --max ``` -------------------------------- ### Set up PostgreSQL User and Databases for mygpo Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/postgres-setup.rst This SQL script creates a 'mygpo' user with a specified password, grants database creation privileges, and sets up 'mygpo' and 'test_mygpo' databases. It also assigns ownership and grants all privileges to the 'mygpo' user for both databases, and sets a statement timeout for the user. ```sql CREATE USER mygpo WITH PASSWORD 'mygpo'; ALTER USER mygpo CREATEDB; -- required for creating test database CREATE DATABASE mygpo; CREATE DATABASE test_mygpo; GRANT ALL PRIVILEGES ON DATABASE mygpo to mygpo; GRANT ALL PRIVILEGES ON DATABASE test_mygpo to mygpo; ALTER DATABASE mygpo OWNER TO mygpo; ALTER DATABASE test_mygpo OWNER TO mygpo; ALTER ROLE mygpo SET statement_timeout = 5000; ``` -------------------------------- ### Retrieve Suggested Podcasts API Endpoint Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/suggestions.rst Details the HTTP GET endpoint for retrieving suggested podcasts, including required authentication, parameters, and example request/response payloads for various formats like OPML and JSON. ```http GET /suggestions/10.opml ``` ```http HTTP/1.1 200 OK [ { "website": "http://www.linuxgeekdom.com", "mygpo_link": "http://gpodder.net/podcast/64439", "description": "Linux Geekdom", "subscribers": 0, "title": "Linux Geekdom", "author": "aj@linuxgeekdom.com (A.J. Stringham)", "url": "http://www.linuxgeekdom.com/rssmp3.xml", "logo_url": null }, { "website": "http://goinglinux.com", "mygpo_link": "http://gpodder.net/podcast/11171", "description": "Going Linux", "subscribers": 571, "title": "Going Linux", "author": "Larry Bushey", "url": "http://goinglinux.com/mp3podcast.xml", "logo_url": "http://goinglinux.com/images/GoingLinux80.png" }] ``` ```APIDOC Endpoint: GET /suggestions/(int:number).(format) Synopsis: retrieve suggested podcasts Requirements: - HTTP authentication - Since 1.0 Description: Download a list of podcasts that the user has not yet subscribed to (by checking all server-side subscription lists) and that might be interesting to the user based on existing subscriptions (again on all server-side subscription lists). The TXT format is a simple URL list (one URL per line), and the OPML file is a "standard" OPML feed. The JSON format looks as follows: Parameters: - name: number type: int description: the maximum number of podcasts to return - name: format description: see :ref:formats - name: jsonp (query) description: function name for the JSONP format (since 2.8) Response Details: - The server does not specify the "relevance" for the podcast suggestion. - The client application SHOULD filter out any podcasts that are already added to the client application but that the server does not know about yet (although this is just a suggestion for a good client-side UX). - JSON Response Fields: - website: string (e.g., "http://www.linuxgeekdom.com") - mygpo_link: string (e.g., "http://gpodder.net/podcast/64439") - description: string (e.g., "Linux Geekdom") - subscribers: integer (e.g., 0) - title: string (e.g., "Linux Geekdom") - author: string (e.g., "aj@linuxgeekdom.com (A.J. Stringham)") - url: string (e.g., "http://www.linuxgeekdom.com/rssmp3.xml") - logo_url: string or null (e.g., "http://goinglinux.com/images/GoingLinux80.png") ``` -------------------------------- ### Example gpodder.net Client Configuration JSON Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/clientconfig.rst This JSON configuration file provides essential parameters for gpodder.net clients. It includes `mygpo/baseurl` for appending gpodder.net API Endpoints, `mygpo-feedservice/baseurl` for the feed service's base URL, and `update_timeout` specifying the validity period in seconds for the file's values. ```json { "mygpo": { "baseurl": "http://gpodder.net/" }, "mygpo-feedservice": { "baseurl": "http://mygpo-feedservice.appspot.com/" }, "update_timeout": 604800 } ``` -------------------------------- ### Get Settings API Endpoint (GET) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/settings.rst Allows clients to retrieve current settings for a specific scope (account, device, podcast, episode). Requires authentication. ```APIDOC GET /api/2/settings/(username)/(scope).json Synopsis: Retrieve current settings Authentication: Required Since: 2.4 Parameters: scope: One of account, device, podcast, episode. podcast (query string): Feed URL of a podcast (required for scope podcast and episode). device (query): Device id (required for scope device). episode (query): Media URL of the episode (required for scope episode). ``` ```http { "setting1": "value1", "setting2": "value2" } ``` -------------------------------- ### Perform Dry Run for mygpo Feed Downloader Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Runs the `feed-downloader` Django management command in dry-run mode (`--list-only`), which lists feeds to be processed without making actual web requests. This is useful for testing and debugging feed processing logic. ```bash envdir envs/dev apython manage.py feed-downloader --list-only [other parameters] ``` -------------------------------- ### Assign Publisher Role to User for Feed URL Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Uses the `make-publisher` Django management command to assign a specified user as a publisher for one or more given feed URLs. This command helps manage content ownership and relationships within the mygpo application. ```bash envdir envs/dev python manage.py make-publisher [...] ``` -------------------------------- ### Python: Setup Jupyter Notebook Environment for Django Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/jupyter-notebook.rst This Python code snippet is used in the first cell of a Jupyter Notebook to set up the environment. It configures the project path, adds it to the system path, sets the Django settings module, and initializes Django, allowing subsequent cells to interact with the Django project. ```python MYPROJECT = '/path/to/mygpo' import os, sys sys.path.insert(0, MYPROJECT) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "local_settings.py") import django django.setup() ``` -------------------------------- ### General Server Response with Rewritten URLs Source: https://github.com/gpodder/mygpo/blob/master/doc/api/api1.rst Examples of server responses that include a 'timestamp' and an 'update_urls' list, detailing original and sanitized URLs. This format is used for both subscription and episode updates. ```json {"timestamp": 1337, "update_urls": [ ["http://feeds2.feedburner.com/LinuxOutlaws?format=xml", "http://feeds.feedburner.com/LinuxOutlaws"], ["http://example.org/podcast.rss ", "http://example.org/podcast.rss"]]} ``` ```json {"timestamp": 1337, "update_urls": [ ["http://feeds2.feedburner.com/LinuxOutlaws?format=xml", "http://feeds.feedburner.com/LinuxOutlaws"], ["http://example.org/episode.mp3 ", "http://example.org/episode.mp3"]]} ``` -------------------------------- ### Example XML Structure for Podcast Data Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/general.rst This XML structure demonstrates how podcast information is represented in the gPodder mygpo API when using the XML format. It mirrors the data points available in the JSON format, including title, URL, website, author, and subscriber details. ```xml Linux Outlaws http://feeds.feedburner.com/linuxoutlaws http://sixgun.org http://gpodder.net/podcast/11092 Sixgun Productions The hardest-hitting Linux podcast around 1954 http://sixgun.org/files/linuxoutlaws.jpg http://gpodder.net/logo/64/fa9fd87a4f9e488096e52839450afe0b120684b4.jpg ``` -------------------------------- ### Update mygpo Episode Toplist Data Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Executes the Django management command to update the episode toplist data in the mygpo database. This is part of the regular maintenance tasks for refreshing derived data, ensuring episode rankings are current. ```bash envdir envs/dev python manage.py update-episode-toplist ``` -------------------------------- ### Example JSON Structure for Podcast Data Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/general.rst This JSON object illustrates the structure used to represent podcast information within the gPodder mygpo API. It includes details such as website, description, title, author, feed URL, subscriber count, and various image URLs. ```json [ { "website": "http://sixgun.org", "description": "The hardest-hitting Linux podcast around", "title": "Linux Outlaws", "author": "Sixgun Productions", "url": "http://feeds.feedburner.com/linuxoutlaws", "position_last_week": 1, "subscribers": 1954, "mygpo_link": "http://gpodder.net/podcast/11092", "logo_url": "http://sixgun.org/files/linuxoutlaws.jpg", "scaled_logo_url": "http://gpodder.net/logo/64/fa9fd87a4f9e488096e52839450afe0b120684b4.jpg" } ] ``` -------------------------------- ### Podcast Search API Endpoint (`GET /search.(format)`) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/directory.rst Documents the gPodder.net API endpoint for performing service-wide podcast searches. This public endpoint allows users to query for podcasts using various parameters and receive results in specified formats. It outlines the `q` (search query), `jsonp`, `scale_logo` query parameters, and the `format` path parameter. ```APIDOC Endpoint: GET /search.(format) Description: Carries out a service-wide search for podcasts that match the given query. Returns a list of podcasts. Authentication: Not required (public content). Since: 2.0 Parameters: - :query q: Search query. - :query jsonp: Used to wrap the JSON results in a function call (JSONP); the value of this parameter is the name of the function (since 2.8). - :query scale_logo: When set, results (only JSON and XML formats) include links to podcast logos scaled to the requested size, provided in the `scaled_logo_url` field (since 2.9). - :param format: See :ref:`formats`. ``` -------------------------------- ### gpodder.net API 2 Sections Overview Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/index.rst Lists the main sections of the gpodder.net API 2 documentation, including general information, authentication, directory services, suggestions, device management, subscriptions, events, podcast lists, user settings, favorites, synchronization, and client configuration. ```APIDOC gpodder.net API 2 Sections: - general - auth - directory - suggestions - devices - subscriptions - events - podcastlists - settings - favorites - sync - clientconfig ``` -------------------------------- ### Get Device Updates (GET /api/2/updates/{username}/{deviceid}.json) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/devices.rst Returns episode and subscription updates for the given device. This endpoint requires authentication and is available since version 2.3. The response includes lists of added subscriptions, removed URLs, updated episodes, and the current timestamp. An optional `include_actions` query parameter can be used to include the user's latest episode action. ```APIDOC GET /api/2/updates/(username)/(deviceid).json Synopsis: returns episode and subscription updates for the given device Requires: Authentication Since: 2.3 Parameters: username (string): the username for which the devices should be returned deviceid (string): see devices Query Parameters: since (timestamp): timestamp when updates have last been retrieved include_actions (boolean): Default: false, since 2.10. If true, each updated episode (with a state other than new) will contain an additional property 'action'. Response Structure: { "add": [ { "title": "string", "url": "string", "description": "string", "subscribers": "integer", "logo_url": "string", "website": "string", "mygpo_link": "string" } ], "remove": ["string"], // URLs to be unsubscribed "updates": [ { "title": "string", "url": "string", "podcast_title": "string", "podcast_url": "string", "description": "string", "website": "string", "mygpo_link": "string", "released": "string (ISO 8601 timestamp)", "status": "(new|play|download|delete)", "action": "string" // if include_actions is true } ], "timestamp": "timestamp" // current timestamp } ``` ```HTTP HTTP/1.1 200 OK { "add": [ { "title": "PaulDotCom Security Weekly", "url": "http://pauldotcom.com/podcast/psw.xml", "description": "PaulDotCom Security Weekly Podcast with Paul, Larry, Mick, Carlos, and special guests!", "subscribers": 93, "logo_url": "http://pauldotcom.com/images/psw-logo-sm.png", "website": "http://pauldotcom.com/", "mygpo_link": "http://gpodder.net/podcast/11194" } ], "remove": [""], "updates": [ { "title": "TWiT 245: No Hitler For You", "url": "http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3", "podcast_title": "this WEEK in TECH - MP3 Edition", "podcast_url": "http://leo.am/podcasts/twit", "description": "[...]", "website": "http://www.podtrac.com/pts/redirect.mp3/aolradio.podcast.aol.com/twit/twit0245.mp3", "mygpo_link": "http://gpodder.net/episode/1046492", "released": """2009-12-12T09:00:00", "status": "(new|play|download|delete)" } ], "timestamp": "" } ``` -------------------------------- ### Legacy API: Get Subscription List Source: https://github.com/gpodder/mygpo/blob/master/doc/api/api1.rst This endpoint returns the main subscription list of the user as OPML content. ```APIDOC Endpoint: /getlist Method: GET (implied) Parameters: username: The user's e-mail address. password: The user's password in plaintext. Returns: OPML content of the user's main subscription list. ``` -------------------------------- ### Known Settings API Reference Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/settings.rst Describes the predefined settings keys available for different scopes (Account, Episode, Podcast) and their effects on the gpodder.net website. ```APIDOC Known Settings: Account: public_profile: When set to False, sets all podcasts to private (currently deactivated via API). store_user_agent: Allow gpodder.net to store the User-Agent for each device (default: true). public_subscriptions: Default "public" value for subscriptions (default: true). Episode: is_favorite: Flags the episode as favorite (can be done on any episode-page). Podcast: public_subscription: When set to False, sets the subscription to this podcast to private (currently deactivated via API). ``` -------------------------------- ### Legacy API: Get Top 50 Podcasts Source: https://github.com/gpodder/mygpo/blob/master/doc/api/api1.rst This endpoint should return an OPML file with the top 50 podcasts. It is equivalent to the Simple API endpoint /toplist/50.opml. ```APIDOC Endpoint: /toplist.opml Method: GET (implied) Parameters: None Returns: OPML file with the top 50 podcasts. ``` -------------------------------- ### Get a Specific Podcast List API Endpoint Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/podcastlists.rst This endpoint retrieves a single podcast list belonging to a specified user by its name. The list is returned in the requested format. ```APIDOC GET /api/2/lists/(username)/list/(listname).(format) Synopsis: get a podcast list Since: 2.10 Parameters: - Path: - username (string): The username to which the list belongs. - listname (string): The name of the requested podcast list. - format (string): The desired format for the response (see formats). Responses: - 200 OK: The podcast list is returned in the requested format. - 404 Not Found: If the user or the list do not exist. ``` -------------------------------- ### gpodder.net Client Libraries Overview Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/libraries.rst An overview of available client libraries for interacting with gpodder.net and feeds.gpodder.net APIs, detailing their language, features, latest version, projects using them, and status. ```APIDOC Library: mygpoclient Programming Language: Python Features: gpodder.net (nearly full support) Latest Version: 1.6 Used by: gpodder Status: Active ``` ```APIDOC Library: libmygpo-qt Programming Language: C++/Qt Features: gpodder.net (nearly full support) Latest Version: 1.0.7 Used by: Amarok,Clementine Status: Active ``` ```APIDOC Library: mygpoclient-java Programming Language: Java Features: gpodder.net (partial) and feeds.gpodder.net (full) Latest Version: 0.0 Used by: Podder,Detlef Status: Active ``` ```APIDOC Library: mygpodderlib Programming Language: Java Features: gpodder.net (partial support) Latest Version: 0.0 Used by: gpodroid Status: Abandoned (?) ``` -------------------------------- ### gPodder Advanced API v2.1 Changes Source: https://github.com/gpodder/mygpo/blob/master/doc/api/changes.rst Updates introduced in gPodder Advanced API version 2.1, adding the 'aggregated=true' parameter to the episode actions get API. ```APIDOC Added: - 'aggregated=true' to api-episode-actions-get (bug 1030) ``` -------------------------------- ### Podcast Search API Endpoint Source: https://github.com/gpodder/mygpo/blob/master/mygpo/directory/templates/search.html This API endpoint allows programmatic searching for podcasts. Users can query for podcasts by appending a search term to the URL. The example demonstrates how to search for 'tech' related podcasts. ```APIDOC Endpoint: GET /search.opml Description: Search for podcasts. Parameters: q (string): The search query. Example Usage: http://{{domain}}/search.opml?q=tech ``` -------------------------------- ### Advertising Configuration Environment Variables Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/configuration.rst Environment variables related to advertising settings, specifically for identifying the currently advertising podcast. ```APIDOC PODCAST_AD_ID: Database Id of the podcast which is currently advertising. ``` -------------------------------- ### Legacy API: Register User Account Source: https://github.com/gpodder/mygpo/blob/master/doc/api/api1.rst This web page is to be opened in a web browser if the user chooses to create a new user account. ```APIDOC Endpoint: /register Method: GET (implied, as it's a web page to be opened) Parameters: None Usage: Open in a web browser to create a new user account. ``` -------------------------------- ### Get Subscriptions of Device API Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/subscriptions.rst Retrieves a list of subscribed podcasts for a specific user and device. This endpoint requires HTTP authentication and has been available since version 1.0. It supports various output formats. ```APIDOC Method: GET Path: /subscriptions/(username)/(deviceid).(format) Synopsis: Get a list of subscribed podcasts for the given user. Requires HTTP authentication: Yes Since: 1.0 Parameters: username (path): username for which subscriptions should be returned deviceid (path): see :ref:`devices` format (path): see :ref:`formats` jsonp (query): function name for the JSONP format (since 2.8) Status Codes: 200: the subscriptions are returned in the requested format 401: Invalid user 404: Invalid device ID 400: Invalid format ``` ```HTTP GET /subscriptions/bob/asdf.opml ``` -------------------------------- ### gPodder mygpo API Variants Overview Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/general.rst This section differentiates between the Simple API and the Advanced API variants offered by gPodder mygpo. It highlights their respective capabilities, limitations, and suitability for different client integration needs, from bulk operations to tight, stateful synchronization. ```APIDOC API Variants: - Simple API: - Purpose: Upload and download subscription lists in bulk. - Benefits: Quick integration, client can be stateless, low-powered. - Limitations: No synchronization of episode status fields, uses more bandwidth. - Advanced API: - Purpose: More flexibility and enhanced functionality for tighter integration. - Features: Supports synchronization of episode status fields, only changes to subscriptions are uploaded/downloaded, uses only JSON. - Requirements: Client must persist synchronization state locally. ``` -------------------------------- ### Displaying Newest Episodes and Welcome Message in Django Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/dashboard.html This Django template snippet shows how to conditionally display a list of the newest podcast episodes for a user, or a welcome message if no new episodes are available. It utilizes the 'cache' tag for performance, iterates through episodes, and employs custom tags like 'podcast_logo', 'episode_link', 'podcast_group_link', 'naturalday', and 'nbsp' for formatting and linking. It also provides guidance for new users and links to help resources. ```HTML (Django) {% cache 600 newest_episodes user.username %} {% if newest_episodes %} {% trans "Newest Episodes" %} ----------------------------- {% for episode in newest_episodes %} {% endfor %} {{ episode.podcast|podcast_logo }} {% episode_link episode episode.podcast %} {% podcast_group_link episode.podcast %} {{ episode.released|naturalday|nbsp }} {% else %} {% blocktrans %}Welcome to {{ site }}! If this is your first visit, you should set up your [podcast client](https://gpoddernet.readthedocs.io/en/latest/user/clients.html) and try to check as many _Explore_ boxes as you can.{% endblocktrans %} {% url "help" as help %} {% blocktrans %}If you have problems, have a look at the [docs]({{ help }}) or ask questions on the [mailing list](https://gpodder.github.io/docs/mailing-list.html) or [forum](https://github.com/gpodder/mygpo/issues).{% endblocktrans %} {% endif %} {% endcache %} ``` -------------------------------- ### Get Podcast Toplist API Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/directory.rst Retrieves a list of the most popular podcasts. This endpoint does not require authentication and is available since version 1.0. It allows specifying the number of podcasts to return and the response format. ```APIDOC GET /toplist/(int:number).(format) Synopsis: Get list of most popular podcasts Authentication: Not required (public content) Since: 1.0 Example Request: GET /toplist/50.json Example Response: HTTP/1.1 200 OK [ { "website": "http://linuxoutlaws.com/podcast", "description": "Open source talk with a serious attitude", "title": "Linux Outlaws", "author": "Sixgun Productions", "url": "http://feeds.feedburner.com/linuxoutlaws", "position_last_week": 0, "subscribers": 1736, "mygpo_link": "http://www.gpodder.net/podcast/11092", "logo_url": "http://linuxoutlaws.com/files/albumart-itunes.jpg" }, { "website": "http://www.twit.tv/", "description": "Your first podcast of the week is the last word in tech. Join the top tech pundits as they discuss the week's top tech news. Every Sunday, Leo Laporte and guests offer an amusing and informative look at the week's most important tech stories. Records live every Sunday at 5:00pm Pacific, 8:00pm Eastern. Part of the TWiT Netcast Network.", "title": "this WEEK in TECH - MP3 Edition", "author": "Leo Laporte", "url": "http://leo.am/podcasts/twit", "position_last_week": 0, "subscribers": 895, "mygpo_link": "http://thisweekintech.com/", "logo_url": "http://leoville.tv/podcasts/coverart/twit144audio.jpg" } ] ``` -------------------------------- ### HTML Link for Direct Podcast Subscription Source: https://github.com/gpodder/mygpo/blob/master/mygpo/publisher/templates/link.html This HTML snippet provides a direct subscription link for podcasts. It allows users to subscribe to a podcast by clicking an image. The placeholder 'YOUR_ADRESS' must be replaced with the actual podcast feed URL. ```HTML ``` -------------------------------- ### Update mygpo Toplist Data Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/installation.rst Runs the Django management command to update the toplist data within the mygpo database. This command is typically used for regularly calculating and refreshing derived data on a production or development server. ```bash envdir envs/dev python manage.py update-toplist ``` -------------------------------- ### GET /api/2/subscriptions/(username)/(deviceid).json API Definition Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/subscriptions.rst Defines the API endpoint for retrieving subscription changes, including its method, path, synopsis, requirements, detailed description, path parameters, and query parameters. ```APIDOC GET /api/2/subscriptions/(username)/(deviceid).json Synopsis: retrieve subscription changes Requirements: - Requires HTTP authentication - Since 2.0 Description: This API call retrieves the subscription changes since the timestamp provided in the since parameter. Its value SHOULD be timestamp value from the previous call to this API endpoint. If there has been no previous call, the cliend SHOULD use 0. The response format is the same as the upload format: A dictionary with two keys "add" and "remove" where the value for each key is a list of URLs that should be added or removed. The timestamp SHOULD be stored by the client in order to provide it in the since parameter in the next request. Path Parameters: - username: username for which subscriptions should be returned - deviceid: see :ref:`devices` Query Parameters: - since: the `timestamp` value of the last response Response Format: - Keys: "add" (list of URLs), "remove" (list of URLs), "timestamp" (integer) ``` -------------------------------- ### gPodder Advanced API v2.4 Changes Source: https://github.com/gpodder/mygpo/blob/master/doc/api/changes.rst Updates introduced in gPodder Advanced API version 2.4, adding new APIs for setting and getting user settings, and for favorite episodes. ```APIDOC Added: - api-settings-set (bug 1082) - api-settings-get - api-favorite-episodes ``` -------------------------------- ### Directory Configuration Environment Variables Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/configuration.rst Environment variables for managing the podcast directory, including excluded tags and search result cutoff. ```APIDOC DIRECTORY_EXCLUDED_TAGS: Space-separated list of tags that should be excluded from the podcast directory. SEARCH_CUTOFF: Minimum search rank (between 0 and 1, default 0.3) below which results are excluded. See Django's documentation on Weighting queries. ``` -------------------------------- ### Django Template for Suggested Podcasts Page Source: https://github.com/gpodder/mygpo/blob/master/mygpo/suggestions/templates/suggestions.html This snippet defines the structure and content for a web page displaying suggested podcasts. It extends a base template, loads custom tags, handles internationalization, iterates through a list of podcast entries, and provides links for subscription, group viewing, and an option to mark 'No Interest'. It also includes a link to download OPML if suggestions exist. ```Django Template Language {% extends "base.html" %} {% load i18n %} {% load podcasts %} {% load menu %} {% block mainmenu %}{{ "/suggestions/"|main_menu }}{% endblock %} {% block sectionmenu %}{{ "/suggestions/"|section_menu }}{% endblock %} {% block title %}{% trans "Suggested Podcasts" %}{% endblock %} {% block header %} {% trans "Suggested Podcasts" %} ================================ {% endblock %} {% block content %} {% for podcast in entries %} {{ podcast|podcast_logo_big }} {% podcast_group_link podcast %}  [{% trans "Subscribe" %}]({% podcast_link_target podcast }) {% csrf_token %}  {% trans "No Interest" %} {{ podcast.description|truncatewords:100 }} {% empty %} {% trans "No Suggestions Yet" %} {% endfor %} {% if entries %} [{% trans "Download OPML" %}]({% url }){% endif %} {% endblock %} ``` -------------------------------- ### Get User Device Synchronization Status (API) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/sync.rst Retrieves the synchronization status for a user's devices. This endpoint requires authentication and is available since version 2.10. The response indicates which device pairs are synchronized and which are not. ```APIDOC HTTP Method: GET Endpoint: /api/2/sync-devices/(username).json Synopsis: get the sync status of a user Authentication: required Version: since 2.10 Parameters: - username (string): username for which the sync status is requested Example Response: { "synchronized": [ ["notebook", "n900"], ["pc-home", "pc-work"] ], "not-synchronized": [ "test-pc", "netbook" ] } ``` -------------------------------- ### Get User's Podcast Lists API Endpoint Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/podcastlists.rst This endpoint retrieves all podcast lists associated with a specific user. It returns a JSON array of list objects, each containing title, name, and web URL. ```APIDOC GET /api/2/lists/(username).json Synopsis: get a user's podcast lists Since: 2.10 Parameters: - Path: - username (string): The username to retrieve podcast lists for. Responses: - 200 OK: Returns a JSON array of podcast list objects. Example: [ { "title": "My Python Podcasts", "name": "my-python-podcasts", "web": "http://gpodder.net/user/a-user/lists/my-python-podcasts" } ] - 404 Not Found: If the user was not found. ``` -------------------------------- ### API Endpoint: Get User Favorite Episodes Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/favorites.rst Retrieves a list of all favorite episodes for a specified user. This endpoint requires authentication and was added in version 2.4 (released in 2.6). The response mirrors the favorites view on gpodder.net. ```APIDOC Endpoint: GET /api/2/favorites/(username).json Synopsis: return the user's favorite episodes Details: - Requires Authentication - Since 2.4 (added released in 2.6) Parameters: - username: username for which the favorites should be returned ``` -------------------------------- ### Render Podcast Subscription Page with Device List Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/subscribe.html This snippet defines the main structure for the podcast subscription page. It extends a base template, includes internationalization and utility tags, and dynamically lists devices a user can subscribe to. It also provides a message if no devices are available and explains why a podcast might be unnamed initially. ```Django Template {% extends "podcast-base.html" %} {% load i18n %} {% load podcasts %} {% load utils %} {% load devices %} {% block title %}{% blocktrans with podcast.title|default:"Unnamed Podcast"|striptags as podcasttitle %}Subscribe to {{ podcasttitle }}{% endblocktrans %}{% endblock %} {% block content %} {% trans "Subscribe" %} ----------------------- {% if targets|length %} {% csrf_token %} {% for target in targets %} {% if target|is_syncgroup %} {% for t in target.client_set.all %} [{{ t|device_icon }}{{ t.name|striptags }}]({% url }) {% endfor %} {% else %} [{{ target|device_icon }}{{ target.name|striptags }}]({% url }) {% endif %} {% endfor %} {% trans "Subscribe" %} {% else %} {% trans "You can't subscribe to this podcast, because you don't have any devices (on which you don't have subscribed to the podcast already)." %} [{% trans "Create Device" %}]({% url }) {% endif %} {% if not podcast.title %} **{% trans "Why Unnamed Podcast?" %}** {% trans "Because we display names after we have fetched the information from the feed -- and this may take some time. Until this is completed, the podcast will simply be called this way." %} {% endif %} {% endblock %} ``` -------------------------------- ### Django Template Base and Load Tags Source: https://github.com/gpodder/mygpo/blob/master/mygpo/publisher/templates/publisher/podcast.html Demonstrates the basic structure of a Django template, including extending a base template and loading various custom tag libraries for internationalization, humanization, podcast-specific functions, and more. ```Django Template {% extends "base.html" %} {% load i18n %} {% load humanize %} {% load podcasts %} {% load charts %} {% load pcharts %} {% load time %} {% load static %} {% load menu %} {% load utils %} ``` -------------------------------- ### Django Custom Template Filters and Tags Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/privacy.html Examples of using custom template filters (e.g., `|podcast_logo`) and custom template tags (e.g., `{% podcast_group_link %}`) to display specific data or perform actions related to objects like podcasts. ```Django Template {{ podcast|podcast_logo }} {% podcast_group_link podcast %} ``` -------------------------------- ### gPodder mygpo API Data Formats and Parametrization Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/general.rst This section details the various data formats supported by the gPodder mygpo API, including JSON, XML, OPML, and plain text. It also explains the JSONP callback mechanism and the client configuration parametrization process. ```APIDOC Date Format: - ISO 8601 / RFC 3339: YYYY-MM-DDTHH:MM:SSZ Formats: - All data exchanged as JSON objects. Requests are also expected to contain JSON objects. - JSONP Callbacks: Pass 'json=' parameter to any GET call to wrap results in a JSON function. - Other Supported Formats: - OPML - JSON - JSONP (since 2.8, with optional function name) - Plain text (one URL per line) - XML (custom format, since 2.9) API Parametrization (Since 2.7): - Clients should retrieve and process clientconfig.json before making requests. - Default configuration can be assumed if client cannot process configuration. ``` -------------------------------- ### Python Project Dependencies for gPodder mygpo Source: https://github.com/gpodder/mygpo/blob/master/requirements-setup.txt Lists the required Python packages and their exact versions for the gPodder mygpo project, typically found in a 'requirements.txt' file. ```Python envdir gevent==21.12.0 sentry-sdk==1.9.10 ``` -------------------------------- ### Basic Robots.txt Configuration Source: https://github.com/gpodder/mygpo/blob/master/static/robots.txt This snippet shows a standard robots.txt file configuration. It allows all user-agents to crawl the site, enforces a 5-second delay between requests, and prevents access to the /admin directory. ```Robots.txt User-agent: * Crawl-delay: 5 Disallow: /admin ``` -------------------------------- ### Get All Subscriptions API Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/subscriptions.rst Retrieves a list of all subscribed podcasts for a given user, irrespective of the device. This endpoint requires HTTP authentication and is available since version 2.11. It's useful for initial application startup to present a full list of podcasts. ```APIDOC Method: GET Path: /subscriptions/(username).(format) Synopsis: Get a list of all subscribed podcasts for the given user. Requires HTTP authentication: Yes Since: 2.11 Parameters: username (path): username for which subscriptions should be returned deviceid (path): see :ref:`devices` format (path): see :ref:`formats` jsonp (query): function name for the JSONP format (since 2.8) Status Codes: 200: the subscriptions are returned in the requested format 401: Invalid user 400: Invalid format ``` ```HTTP GET /subscriptions/bob.opml ``` -------------------------------- ### JavaScript for Document Ready and Tooltip Initialization Source: https://github.com/gpodder/mygpo/blob/master/mygpo/directory/templates/carousel.html Uses jQuery to ensure the DOM is fully loaded before initializing Bootstrap tooltips on all elements marked with the `rel=tooltip` attribute. ```JavaScript $(document).ready(function () { if ($("[rel=tooltip]").length) { $("[rel=tooltip]").tooltip(); } }); ``` -------------------------------- ### Base gpodder.net HTML Template Structure Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/home.html This Django HTML template defines the foundational structure for gpodder.net web pages. It includes boilerplate for extending a base layout, loading static files and internationalization, rendering the main menu, handling user authentication states (login/logout/register), and displaying system messages. It serves as the main entry point for the gpodder.net user interface. ```HTML {% extends "skeleton.html" %} {% load i18n %} {% load menu %} {% load static %} {% block titletag %}gpodder.net — discover and track your podcasts{% endblock %} {% block body %} [![gpodder.net]({% static )gpodder.net](/) {% block mainmenu %} {{ "/"|main_menu }} {% endblock %} * {% if user.is_authenticated %} [{{ user.username }}](#) * [Profile]({% url ) * [Sign Out]({% url ) {% else %} {% trans "Login" %} * [{% trans "Login" %}]({% url ) * [{% trans "Register" %}]({% url ){% endif %} {% if messages %} {% for message in messages %} {{ message }} {% endfor %} {% endif %} {% block header %} Discover and track your podcasts ================================ {% endblock %} {% block content %} ![gpodder.net]({% static ) gpodder.net is a libre web service that allows you to manage your podcast subscriptions and discover new content. If you use multiple devices, you can synchronize subscriptions and your listening progress. It works best with the [gPodder](http://gpodder.org/) application, but you can also use it with [Amarok](http://amarok.kde.org/), [other supported clients](https://gpoddernet.readthedocs.io/en/latest/user/clients.html) or as standalone web application without any client app. [{% trans "Login" %}]({% url ) [{% trans "Register" %}]({% url ) ### Features * Share your favorite content with others * Keep track of your playback progress * Back up your subscriptions * Discover new content, based on your listening habits * Create and share lists of related podcasts * _For publishers:_ Find out which parts of your content are popular * * * ``` -------------------------------- ### List User Devices (GET /api/2/devices/{username}.json) Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/devices.rst Returns a list of devices that belong to a user. This endpoint requires HTTP authentication and is available since version 2.0. It can be used by client applications to allow users to select a device from which to retrieve subscriptions or other data. ```APIDOC GET /api/2/devices/(username).json Synopsis: list the user's devices Requires: HTTP authentication Since: 2.0 Parameters: username (string): the username for which the devices should be returned Example Response Structure: [ { "id": "string", "caption": "string", "type": "string", "subscriptions": "integer" }, ... ] ``` ```HTTP HTTP/1.1 200 OK [ { "id": "abcdef", "caption": "gPodder on my Lappy", "type": "laptop", "subscriptions": 27 }, { "id": "09jc23caf", "caption": "", "type": "other", "subscriptions": 30 }, { "id": "phone-au90f923023.203f9j23f", "caption": "My Phone", "type": "mobile", "subscriptions": 5 } ] ``` -------------------------------- ### jQuery for Activating Tab Based on URL Hash Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/account.html This JavaScript snippet, executed on document ready, checks the current URL for a hash fragment (e.g., '#services'). If a hash is present, it uses jQuery to find the corresponding navigation tab and programmatically activates it, enabling deep linking to specific sections of a tabbed interface. ```JavaScript $(document).ready(function() { var url = document.location.toString(); if (url.match('#')) { $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ; } }); ``` -------------------------------- ### Django Template i18n for Public/Private Toggle Source: https://github.com/gpodder/mygpo/blob/master/mygpo/share/templates/share/components/private-toggle.html This snippet shows how to use Django's `load i18n` tag to enable internationalization and the `trans` tag to mark strings ('Public', 'Private') for translation, typically used in a button group. ```Django Template Language {% comment %} A button group that is used to toggle between a private and public setting {% endcomment %} {% load i18n %} {% trans "Public" %} {% trans "Private" %} ``` -------------------------------- ### Apply Basic CSS Styling for Page Layout Source: https://github.com/gpodder/mygpo/blob/master/mygpo/web/templates/skeleton.html This CSS snippet applies basic styling to the `body` element and `.sidebar-nav` class. It sets padding for the body to accommodate a fixed header and footer, and defines padding for a sidebar navigation element, contributing to the overall page layout. ```CSS body { padding-top: 60px; padding-bottom: 40px; } .sidebar-nav { padding: 9px 0; } ``` -------------------------------- ### Django Template for Displaying Podcasts by License Source: https://github.com/gpodder/mygpo/blob/master/mygpo/directory/templates/directory/license-podcasts.html This Django template renders an HTML page that lists podcasts associated with a specific license. It utilizes various custom template tags for internationalization, menu generation, podcast details (logo, group link), subscriber count visualization, and pagination. The template expects context variables such as 'view.license_url', 'view.max_subscribers', 'podcasts' (an iterable), and 'view.page_list'. ```HTML {% extends "base.html" %} {% load i18n %} {% load podcasts %} {% load charts %} {% load math %} {% load utils %} {% load menu %} {% block mainmenu %}{{ "/directory/+license"|main\_menu }}{% endblock %} {% block sectionmenu %}{{ "/directory/+license"|section\_menu }}{% endblock %} {% block title %}{% blocktrans with view.license\_url|license\_name as licensename %}Podcasts with License {{ licensename }}{% endblocktrans %}{% endblock %} {% block header %}\n\n{% blocktrans with view.license\_url|license\_name as licensename %}Podcasts with License {{ licensename }}{% endblocktrans %}\n==============================================================================================================================\n\n{% endblock %} {% block content %}\n\n[{% trans "License overview" %}]({% url ) [{% trans "View License" %}]({{ view.license_url }})\n\n{% for podcast in podcasts %} {% empty %} {% endfor %}\n\n{% trans "Podcast" %}\n\n{% trans "Subscribers" %}\n\n{{ podcast|podcast\_logo }}\n\n{% podcast\_group\_link podcast %}\n\n{% vertical\_bar podcast.subscriber\_count view.max\_subscribers %}\n\n{% trans "Currently not available" %}\n\n{% for page in view.page\_list %}* {% if page == "..." %} {{ page }} {% else %} {% if page == current\_page %} [**{{ page }}**]({% url ) {% else %} [{{ page }}]({% url ) {% endif %} {% endif %}\n{% endfor %}\n\n{% endblock %} ``` -------------------------------- ### Importing Translations from Transifex Source: https://github.com/gpodder/mygpo/blob/master/doc/dev/translate.rst This command sequence imports all available translations for the gpodder.net project from Transifex. It first pulls all resources and then updates the local translation files. ```bash tx pull -a make update ``` -------------------------------- ### gPodder mygpo API General Information Source: https://github.com/gpodder/mygpo/blob/master/doc/api/reference/general.rst This section provides foundational details about the gPodder mygpo API, covering communication protocols, cross-origin resource sharing (CORS) support, and how podcasts and episodes are uniquely identified within the system. ```APIDOC Protocol: - All API requests must use HTTPS. HTTP requests will be redirected. CORS: - All endpoints include 'Access-Control-Allow-Origin: *' header, enabling web application access. Identifying Podcasts and Episodes: - Podcast: Identified by its feed URL. - Episode: Identified by its media URL. ```