get_iplayer forums

Full Version: URL to add pid to Queue ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I am looking for a bit of technical advice

I plan to insert a button
(using Greasemonkey)
next to each pid link in web pages like this
http://radio-lists.org.uk/r4/
so that pressing the button
will queue that pid for later recording
via an url to get_iplayer PVR
(running on localhost,
with queue already refreshed).

Can anyone advise what the url would look like?
Look in the web pvr server window. A query string equivalent to each action is printed. They contain a lot of extra fields you probably don't need. You'll have to experiment to find which ones can be omitted.
Just to share what I got working (version 2)
Code:
// ==UserScript==
// @name        radio-lists
// @namespace   http://userscripts.org/users/99999999999999
// @include    *radio-lists.org.uk*
// @require     http://code.jquery.com/jquery-latest.min.js
// @version     1
// @grant       none
// ==/UserScript==

$( document ).ready( function() {
    var long_str = "&SEARCHFIELDS=pid&PROGTYPES=radio&EXCLUDE=&CATEGORY=&EXCLUDECATEGORY=&CHANNEL=&EXCLUDECHANNEL=&SINCE=&BEFORE=&FUTURE=1&SORT=index&REVERSE=0&PAGESIZE=10&HIDE=0&HIDEDELETED=0&COLS=type&COLS=name&COLS=episode&COLS=desc&COLS=channel&COLS=timeadded&OUTPUT=&VERSIONLIST=&MODES=&PROXY=&SUBTITLES=0&METADATA=&THUMB=0&PVRHOLDOFF=&FORCE=0&AUTOWEBREFRESH=1&AUTOPVRRUN=4&REFRESHFUTURE=0&BITRATE=&VSIZE=&VFR=&STREAMTYPE=&SAVE=0&SEARCHTAB=yes&COLUMNSTAB=no&DISPLAYTAB=no&RECORDINGTAB=no&STREAMINGTAB=no&PAGENO=1&INFO=0&NEXTPAGE=pvr_queue&ACTION=&.cgifields=FORCE&.cgifields=REVERSE&.cgifields=FUTURE&.cgifields=HISTORY&.cgifields=HIDE&.cgifields=PROGTYPES&.cgifields=REFRESHFUTURE&.cgifields=THUMB&.cgifields=HIDEDELETED&.cgifields=COLS&.cgifields=SUBTITLES"
   console.log("hello:"+long_str)
  $('a[href^="http://www.bbc.co.uk/programmes/"][target="_blank"]').each( function(){
      var href = $(this).attr('href')
      var myArr = href.split('/')
      var pid = myArr[myArr.length-1]
      var str = $(this).parent('b').next('br').get(0).nextSibling.nodeValue.trim();
      var comment = $(this).get(0).previousSibling.nodeValue
         comment = comment.substr(6) // remove the time prefix
         comment = comment + "- " + str
      var url = "http://localhost:1935/?SEARCH="
      + encodeURIComponent( "radio|" + pid + "|<"+ comment +">")
      + long_str
      $(this).after(' <a target="pvr" href="'+ url +'">PVR</a>')
      $(this).attr('href', href+'#credits')
   })
})
Here is a GM script to add ⏺ symbol before each item on a BBC radio schedule page
e.g.
R3: https://www.bbc.co.uk/schedules/p00fzl8t/this_week
R4: https://www.bbc.co.uk/schedules/p00fzl7j/this_week
R4X: https://www.bbc.co.uk/schedules/p00fzl7l/this_week
Click on the ⏺ symbol to add the item to the PVR list.
(of course you need to have started get_iplayer PVR beforehand)

This has been tested using the Firefox AddOn called ViolentMonkey to insert the GM script
https://addons.mozilla.org/en-US/firefox...entmonkey/

Code:
// ==UserScript==
// @name        bbc.co.uk-schedules
// @namespace   Violentmonkey Scripts
// @include    *bbc.co.uk/schedules/*
// @require     http://code.jquery.com/jquery-latest.min.js
// @version     1
// @grant       none
// ==/UserScript==

$( document ).ready( function() {
    var long_str = "&SEARCHFIELDS=pid&PROGTYPES=radio&EXCLUDE=&CATEGORY=&EXCLUDECATEGORY=&CHANNEL=&EXCLUDECHANNEL=&SINCE=&BEFORE=&FUTURE=1&SORT=index&REVERSE=0&PAGESIZE=10&HIDE=0&HIDEDELETED=0&COLS=type&COLS=name&COLS=episode&COLS=desc&COLS=channel&COLS=timeadded&OUTPUT=&VERSIONLIST=&MODES=&PROXY=&SUBTITLES=0&METADATA=&THUMB=0&PVRHOLDOFF=&FORCE=0&AUTOWEBREFRESH=1&AUTOPVRRUN=4&REFRESHFUTURE=0&BITRATE=&VSIZE=&VFR=&STREAMTYPE=&SAVE=0&SEARCHTAB=yes&COLUMNSTAB=no&DISPLAYTAB=no&RECORDINGTAB=no&STREAMINGTAB=no&PAGENO=1&INFO=0&NEXTPAGE=pvr_queue&ACTION=&.cgifields=FORCE&.cgifields=REVERSE&.cgifields=FUTURE&.cgifields=HISTORY&.cgifields=HIDE&.cgifields=PROGTYPES&.cgifields=REFRESHFUTURE&.cgifields=THUMB&.cgifields=HIDEDELETED&.cgifields=COLS&.cgifields=SUBTITLES"
   console.log("hello:"+long_str)
  $('a[href^="https://www.bbc.co.uk/programmes/"]').each( function(){
      var href = $(this).attr('href')
      var myArr = href.split('/')
      var pid = myArr[myArr.length-1]
      var comment =$(this).attr('aria-label')
      var url = "http://localhost:1935/?SEARCH="
      + encodeURIComponent( "radio|" + pid + "|<"+ comment +">")
      + long_str
      console.log("url:"+url)
      $(this).before(' <a target="pvr" href="'+ url +'">⏺</a>')
   })
})