Check-in [6c60cc3c77]
Overview
| Comment: | Adds new [history] category in [bookmarks] tab; which lists last played stations. |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
6c60cc3c7789c34439df6b48cf9be6f8 |
| User & Date: | mario on 2014-05-19 19:27:46 |
| Other Links: | manifest | tags |
Context
|
2014-05-25
| ||
| 00:41 | Add custom ComboBoxText for [select] list plugin config options. check-in: bcbd6a4624 user: mario tags: trunk | |
|
2014-05-19
| ||
| 19:27 | Adds new [history] category in [bookmarks] tab; which lists last played stations. check-in: 6c60cc3c77 user: mario tags: trunk | |
| 19:27 | update config dialog check-in: 9d4259a324 user: mario tags: trunk | |
Changes
Added channels/history.py version [e7c8df9075].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
#
# api: streamtuner2
# title: History
# description: List recently played stations under favourites > history.
# version: 1.0
# type: category
# category: ui
# priority: optional
#
# Lists last activated streams in a new [history] tab in the favourites
# channel.
#
#
#
from config import conf, __print__, dbg
from channels import *
class history:
# plugin info
module = "history"
title = "History"
# configuration settings
config = [
{
"name": "history",
"type": "int",
"value": "20",
"description": "Number of last played streams to keep in history list.",
"category": "limit"
}
]
# store
bm = None
# hook up to main tab
def __init__(self, parent):
# keep reference to main window
self.bm = parent.channels["bookmarks"]
# create category
self.bm.add_category("history");
# hook up to .play event
parent.hooks["play"].append(self.queue)
# add to favourites/history stream list
def queue(self, row):
# assert a present store
streams = self.bm.streams
if not "history" in streams:
streams["history"] = []
hist = streams["history"]
# only new entries get added
if not row in hist:
hist.insert(0, row)
# limit number of entries
max = int(conf.history)
while max > 0 and len(hist) > max:
hist.pop()
# update store
self.bm.save()
if self.bm.current == "history":
self.bm.load("history")
|