My favorites
▼
|
Sign in
fricorder
Un programme pour enregistrer la freebox sur ordinateur
Project Home
Downloads
Wiki
Issues
Source
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
10
attachment: fbx.py
(2.0 KB)
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2,os
from __init__ import FConfig
def getStreams():
"""
recupere une liste de tuple (num, nom chaine, stream) directement sur la freebox
"""
list = []
chaine = None
num=None
try:
liste = urllib2.urlopen("http://mafreebox.freebox.fr/freeboxtv/playlist.m3u")
except:
liste = open(os.path.join(FConfig.DATADIR,"nondegroupe.m3u"),"r")
for i in liste:
ligne = i.strip()
if ligne:
if ligne[:11]=="#EXTVLCOPT:":
opt=opt+"--"+ligne[11:]+" "
elif chaine:
list.append( (num,chaine,opt+ligne) )
chaine=None
if ligne[:8]=="#EXTINF:":
line=ligne.split(" - ")
chaine = line[-1]
opt=""
num=int(line[0].split(",")[-1])
return list
def convChaine(fchaine):
""" convertit une chaine freebox en chaine *progTV* (chaine du grabber tv_grab_fr)
"""
fchaine=fchaine.lower().strip()
if fchaine[:8]=="france 3":
#permet de mapper toutes les fr3
return "france3"
else:
t={
"rtl9" :u'rtl9',
"ab 1" :u'ab1',
"tv5" :u'tv5',
"mtv france" :u'mtv',
"france 2" :u'france2',
"france 4" :u'france4',
"arte" :u'arte',
"arte allemand" :u'arte',
"france 5" :u'france5',
}
if fchaine in t.keys():
#utilise le dictionnaire de mappage plus haut
return t[fchaine]
else:
#retourne la chaine freebox en minuscule ! (ca marche pour "arte", par ex)
return fchaine
if __name__ == "__main__":
os.chdir("..")
l=getStreams()
assert len(l)>0
assert convChaine("France 3 Picardie") == "france3"
assert convChaine("France 4") == "france4"
assert convChaine(" ABCDEF ") == "abcdef"
Powered by
Google Project Hosting