Check-in [3746af529b]
Overview
Comment: | Add more subreddits to category list. Placeholder groups with "β" decorator. Allow web-only links per config option (start web browser for sptfy/sndcl etc.) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
3746af529b12b74355d3d7b169d5d308 |
User & Date: | mario on 2015-05-23 01:08:25 |
Other Links: | manifest | tags |
Context
2015-05-23
| ||
15:26 | Fix `id` reference in dependency resolver. check-in: 8289ad11b4 user: mario tags: trunk | |
01:08 | Add more subreddits to category list. Placeholder groups with "β" decorator. Allow web-only links per config option (start web browser for sptfy/sndcl etc.) check-in: 3746af529b user: mario tags: trunk | |
2015-05-22
| ||
22:01 | Catch http/json result errors earlier. Break on absent "after" id. check-in: 8dfd60898f user: mario tags: trunk | |
Changes
Modified Makefile from [14bf4a5119] to [5d44328e24].
︙ | ︙ | |||
80 81 82 83 84 85 86 | $(INST) *.desktop -t /usr/share/applications/ $(INST) icon.png /usr/share/pixmaps/streamtuner2.png $(INST) help/str*2.1 -t /usr/share/man/man1/ # start locally st2: run run: | > | | 80 81 82 83 84 85 86 87 88 89 90 91 | $(INST) *.desktop -t /usr/share/applications/ $(INST) icon.png /usr/share/pixmaps/streamtuner2.png $(INST) help/str*2.1 -t /usr/share/man/man1/ # start locally st2: run run: #MALLOC_CHECK_=2 PYTHONVERBOSE=2 python -B ./st2.py -D yelp: yelp help/index.page 2>/dev/null & |
Modified contrib/reddit.py from [a40c90e15d] to [2555b583aa].
1 2 | # encoding: UTF-8 # api: streamtuner2 | | | | | > > | | 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 | # encoding: UTF-8 # api: streamtuner2 # title: redditβ± # description: Music recommendations from reddit /r/music and associated subreddits. # version: 0.7 # type: channel # url: http://reddit.com/r/Music # category: playlist # config: # { name: reddit_pages, type: int, value: 2, description: Number of pages to fetch. } # { name: kill_soundcloud, type: boolean, value: 1, description: Filter soundcloud/spotify/bandcamp (only web links). } # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJ1BMVEUAAAAcICX/AABHSk1jZ299hYz/bmajq6//lY/d0M3C1+3T7P38+/iaLhuGAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgF # HUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffBRUXIyQbWArCAAAAh0lEQVQI12Pg3g0BDLtXrVq1eveq3Qy7gIxCU9dqEGO11/ZKbzBDenUIUM3u7cGi1UDFW0TE55wsdpZikAw/ # eebMnMmHGVxqDuUc0zzpynD4zIk5J3vOSDNsOQMG1gy7bI5HTq85Ws2wu/jM9PIzrkArdhmXlzuuXg00eVd5+epVqxmgrtgNAOWeS1KYtcY4AAAAAElFTkSuQmCC # priority: extra # # Just imports Youtube links from music-related subreddits. # Those are usually new bands or fresh releases, or favorite # user selections. The category/subreddit list is filtered # for a minimum quote of usable links (namely Youtube URLs, # Soundcloud/Spotify/Bandcamp and weblinks aren't playable.) # # This plugin currently uses the old reddit API, which might # be obsolete by August. It's thus a temporary channel, as # migrating to OAuth or regressing to plain HTML extraction # is not very enticing. import json import re |
︙ | ︙ | |||
43 44 45 46 47 48 49 | has_search = False listformat = "srv" audioformat = "video/youtube" titles = dict(playing="submitter", listeners="votes", bitrate=False) # just subreddit names to extract from categories = [ | > | | | | | < < < < < < < < < < < < < < < < < < | | < < < | > > | > > | > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > | | | | < | | | > > > > > > > > > | 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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | has_search = False listformat = "srv" audioformat = "video/youtube" titles = dict(playing="submitter", listeners="votes", bitrate=False) # just subreddit names to extract from categories = [ # static radio list "radioreddit π", # major subreddits "Music", ["trueMusic", "futurebeats", "FutureFunkAirlines", "Turntablists", "Catchysongs", "MusicForConcentration", "MusicToSleepTo"], # cover bands/songs "CoverSongs", ["ICoveredASong", "MyMusic", "UserProduced", "RepublicOfMusic", "RoyaltyFreeMusic"], # discover subreddits "music_discovery", ["ListenToThis", "ListenToUs", "WhatIListenTo", "ListenToConcerts", "HeadBangToThis", "unheardof", "under10k", "lt10k"], # Classical "ClassicalMusic", ["composer", "baroque", "classicalmusic", "contemporary", "choralmusic", "ChamberMusic", "EarlyMusic", "ElitistClassical", "icm", "Opera", "pianocovers"], # Electronic Music "ElectronicMusic", ["acidhouse", "ambientmusic", "AtmosphericDnB", "BigBeat", "boogiemusic", "breakbeat", "breakcore", #"brostep", "chicagohouse", "chillout", "Chipbreak", "darkstep", "deephouse", "DnB", "DubStep", "EDM", "electronicdancemusic", "ElectronicJazz", "ElectronicBlues", "electrohouse", #"electronicmagic", "ElectronicMusic", "electropop", "electroswing", #"ExperimentalMusic", "fidget", "frenchelectro", "frenchhouse", "funkhouse", "futurebeats", "FutureFunkAirlines", "FutureGarage", "futuresynth", "gabber", "glitch", "Grime", "happyhardcore", "hardhouse", "hardstyle", "house", "idm", "industrialmusic", "ItaloDisco", "latinhouse", "LiquidDubstep", "mashups", "minimal", "moombahcore", "nightstep", "OldskoolRave", "partymusic", "plunderphonics", "psybient", "PsyBreaks", "psytrance", "purplemusic", "raggajungle", "RealDubstep", "swinghouse", "tech_house", "Techno", "Trance", "tranceandbass", "tribalbeats", "ukfunky", "witchhouse", "wuuB"], # Rock / Metal "Rock", ["80sHardcorePunk", "90sAlternative", "90sPunk", "90sRock", "AlternativeRock", "AltCountry", "AORMelodic", "ausmetal", "BlackMetal", "bluegrass", "Blues", "bluesrock", "Boneyard", "CanadianClassicRock", "CanadianMusic", "ClassicRock", "country", "Christcore", "crunkcore", "deathcore", "deathmetal", "Djent", "DoomMetal", "Emo", "EmoScreamo", "epicmetal", "flocked", "folk", "folkmetal", "folkpunk", "folkrock", "folkunknown", "GaragePunk", "GothicMetal", "Grunge", "hardcore", "HardRock", "horrorpunk", "indie_rock", "jrock", "krautrock", "LadiesofMetal", "MathRock", "melodicdeathmetal", "MelodicMetal", "Metalmusic", "metal", "metalcore", "monsterfuzz", "neopsychedelia", "NewWave", "noiserock", "numetal", "pianorock", "poppunkers", "PostHardcore", "PostRock", "powermetal", "powerpop", "ProgMetal", "progrockmusic", "PsychedelicRock", "punk", "Punkskahardcore", "Punk_Rock", "raprock","shoegaze", "stonerrock", "symphonicblackmetal", "symphonicmetal", "synthrock", "truethrash", "Truemetal", "OutlawCountry", "WomenRock"], # hippety-hop "HipHopHeads", ["80sHipHop", "90sHipHop", "altrap", "asianrap", "backspin", "BayRap", "ChapHop", "ChiefKeef", "DrillandBop", "Gfunk", "NYrap", "Rap", "raprock", "rhymesandbeats", "trapmuzik"], # decades "Decades β", ["2010smusic", "2000smusic", "90sMusic", "80sMusic", "70s", "70sMusic", "60sMusic", "50sMusic"], # By country/region/culture "WorldMusic", ["AfricanMusic", "afrobeat", "balkanbrass", "balkanmusic", "britpop", "Irishmusic", "ItalianMusic", "jpop", "kpop", "spop", "cpop"], # Other "Genres β", ["Acappella", "AcousticCovers", "animemusic", "boomswing", "bossanova", "carmusic", "chillmusic", "dembow", "disco", "DreamPop", "Elephant6", "ETIMusic", "Exotica", "FilmMusic", "FunkSouMusic", "gamemusic", "GamesMusicMixMash", "GunslingerMusic", "GypsyJazz", "HomeworkMusic", "IndieFolk", "Jazz", "JazzFusion", "JazzInfluence", "listentoconcerts", "klezmer", "lt10k", "MedievalMusic", "MelancholyMusic", "minimalism_music", "motown", "MovieMusic", "muzyka", "NuDisco", "oldiemusic", "OldiesMusic", "pianocovers", "PopMusic", "PoptoRock", "rainymood", #"recordstorefinds", "reggae", "remixxd", "RetroMusic", "rnb", "rootsmusic", "SalsaMusic", "Ska", "Soca", "Soulies", "SoulDivas", "SoundsVintage", "SpaceMusic", "swing", "Tango", "TheRealBookVideos", "TouhouMusic", "TraditionalMusic", "treemusic", "triphop", "vaporwave", "VintageObscura", "vocaloid"], # Redditor Made Music (removed some spotify/soundcloud-only subreddits) "Redditor-Made β", ["AcousticOriginals", "Composer", "ICoveredASong", "independentmusic", "MusicCritique", "MyMusic", "ratemyband", "Songwriters", "ThisIsOurMusic", "UserProduced",], # Multi-Genre & Community Subreddits (a third cleaned out for too few usable links) "Community β", ["audioinsurrection", "albumaday", "albumoftheday", #"Albums", "albumlisteners", "BinauralMusic", "Catchysongs", "CircleMusic", "CoverSongs", "cyberpunk_music", "DANCEPARTY", "danktunes", "deepcuts", "EarlyMusic", "FemaleVocalists", "FitTunes", "freemusic", "Frisson", "GayMusic", "germusic", "gethightothis", "GuiltyPleasureMusic", "HeadNodders", "heady", "HeyThatWasIn", "indie", "IndieWok", "Instrumentals", "ipm", "IsolatedVocals", "LetsTalkMusic", "listentoconcerts", "listentomusic", "ListenToThis", "ListenToUs", "livemusic", "llawenyddhebddiwedd", "Lyrics", "mainstreammusic", "MiddleEasternMusic", "MLPtunes", "Music", "MusicAlbums", "musicsuggestions", "MusicToSleepTo", "musicvideos", "NameThatSong", "newmusic", "onealbumaweek", "partymusic", "RedditOriginals", "RepublicOfMusic", "RoyaltyFreeMusic", "runningmusic", "ScottishMusic", "ThemVoices", "unheardof", "WhatIListenTo", "WTFMusicVideos"], # Community #["AlbumArtPorn", "albumreviews", "Audio", "Audiophile", "AustinMusicians", #"bandmembers", "CarAV", "CassetteCulture", "Cd_collectors", #"ConcertTickets", "germusic", "glastonbury_festival", "ICoveredASong", #"ifyoulikeblank", "independentmusic", "ineedasong/", "japanesemusic", #"Jazzguitar", "koreanmusic", "LubbockMusicians", "mixcd", "musiccritics", #"MusicalComedy", "musicessentials", "MusicEventMeetUp", "musicfestivals", #"musicnews", "MusiciansBlogs", "Musicians", "NeedVocals", "OSOM", #"performer", "RecordClub", "recordstore", "redditmusicclub", "Rockband", #"RockbandChallenges", "TheSongRemainsTheSame", "TipOfMyTongue", #"TouringMusicians", "vinyl", "VinylReleases", "WeAreTheMusicMakers"], # Single Artist/Band subreddits (unchecked list) "Bands/Artists β", ["311", "ADTR", "AliciaKeys", "ArcadeFire", "ArethaFranklin", "APerfectCircle", "TheAvettBrothers", "BaysideIsACult", "TheBeachBoys", "Beatles", "billytalent", "Blink182", "BMSR", "boniver", "brandnew", "BruceSpringsteen", "Burial", "ChristinaAguilera", "cityandcolour", "Coldplay", "CutCopy", "TheCure", "DaftPunk", "DavidBowie", "Deadmau5", "DeathCabforCutie", "DeepPurple", "Deftones", "DieAntwoord", "DMB", "elliegoulding", "empireofthesun", "EnterShikari", "Evanescence", "feedme", "FirstAidKit", "flaminglips", "franzferdinand", "Gorillaz", "gratefuldead", "Greenday", "GunsNRoses", "Incubus", "JackWhite", "JanetJackson", "John_frusciante", "kings_of_leon", "Korn", "ladygaga", "lanadelrey", "lennykravitz", "Led_Zeppelin", "lorde", "Macklemore", "Madonna", "Manowar", "MariahCarey", "MattAndKim", "Megadeth", "Metallica", "MGMT", "MichaelJackson", "MinusTheBear", "ModestMouse", "Morrissey", "MyChemicalRomance", "Muse", "NeilYoung", "NIN", "Nirvana", "oasis", "Opeth", "OFWGKTA(OddFuture)", "OutKast", "panicatthedisco", "PearlJam", "phish", "Pinback", "PinkFloyd", "porcupinetree", "prettylights", "Puscifer", "Queen", "Radiohead", "RATM", "RedHotChiliPeppers", "The_Residents", "RiseAgainst", "Rush", "SigurRos", "Slayer", "slipknot", "SmashingPumpkins", "SparksFTW", "TeganAndSara", "TheKillers", "TheOffspring", "TheStrokes", "TheMagneticZeros", "tragicallyhip", "ToolBand", "U2Band", "Umphreys", "UnicornsMusic", "velvetunderground", "Ween", "weezer", "WeirdAl", "yesband", "Zappa"], ] # static def update_categories(self): pass # Extract video/music news links def update_streams(self, cat, search=None): # radioreddit if cat == "radioreddit π": return self.radioreddit() elif cat.find("β") > 0: return self.placeholder # collect links data = [] after = None for i in range(1, int(conf.reddit_pages) + 1): try: j = ahttp.get( "http://www.reddit.com/r/{}/new.json".format(cat.lower()), { "sort": "new", "after": after } ) j = json.loads(j) except Exception as e: log.ERR("Reddit down? -", e) break if j.get("data",{}).get("children"): data += j["data"]["children"] else: break if j.get("data",{}).get("after"): after = j["data"]["after"] else: break # convert r = [] for row in (ls["data"] for ls in data): # find links in text posts text_urls = re.findall("\]\((https?://(?:www\.)?youtu[^\"\'\]\)]+)", row.get("selftext", "")) url_ext = (re.findall("\.(\w+)$", row["url"]) or [None])[0] listformat = "href" state = "gtk-media-play" # Youtube if re.search("youtu", row["url"]): format = "video/youtube" listformat = "srv" # direct MP3/Ogg elif url_ext in ("mp3", "ogg", "flac", "aac", "aacp"): format = "audio/" + url_ext listformat = "srv" # playlists? elif url_ext in ("m3u", "pls", "xspf"): listformat = url_ext format = "audio/x-unknown" # links from selftext elif text_urls: row["url"] = text_urls[0] format = "video/youtube" # filter out Soundcloud etc. elif re.search("soundcloud|spotify|bandcamp", row["url"]): if conf.kill_soundcloud: continue format = "url/http" listformat = "srv" state = "gtk-media-pause" # pure web links etc. else: continue # repack into streams list r.append(dict( title = row["title"], url = row["url"], genre = re.findall("\[(.+?)\]", row["title"] + "[-]")[0], playing = row["author"], listeners = row["score"], homepage = "http://reddit.com{}".format(row["permalink"]), img = row.get("thumbnail", ""), format = format, listformat = listformat, state = state, )) return r # static station list def radioreddit(self): return [ |
︙ | ︙ |