Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
django-panik-emissions
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
radiopanik
django-panik-emissions
Commits
ed3e616d
Commit
ed3e616d
authored
Oct 10, 2019
by
fred
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python3: use print() function
parent
55b3c575
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
24 deletions
+38
-24
emissions/management/commands/_spip2html.py
emissions/management/commands/_spip2html.py
+7
-5
emissions/management/commands/create-sound-files.py
emissions/management/commands/create-sound-files.py
+4
-2
emissions/management/commands/day-program.py
emissions/management/commands/day-program.py
+3
-1
emissions/management/commands/load-from-spip.py
emissions/management/commands/load-from-spip.py
+13
-11
emissions/management/commands/update-emission.py
emissions/management/commands/update-emission.py
+3
-1
emissions/management/commands/week-program.py
emissions/management/commands/week-program.py
+3
-1
emissions/management/commands/whatsonair.py
emissions/management/commands/whatsonair.py
+5
-3
No files found.
emissions/management/commands/_spip2html.py
View file @
ed3e616d
...
...
@@ -38,6 +38,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from
__future__
import
print_function
import
re
import
sys
import
os
...
...
@@ -875,7 +877,7 @@ class SpipParser:
name
,
title
=
name
.
split
(
'|'
,
2
)
except
ValueError
:
# XXX
print
'error splitting'
,
repr
(
name
)
print
(
'error splitting'
,
repr
(
name
)
)
name
,
title
=
oTitle
,
'XXX'
if
not
name
:
name
=
oTitle
...
...
@@ -1013,9 +1015,9 @@ class SpipParser:
try
:
url
=
re
.
findall
(
'href=(.*?)>'
,
self
.
getVar
(
'group'
),
re
.
DOTALL
)[
0
]
except
IndexError
:
print
'XXX'
,
self
.
getVar
(
'group'
)
print
(
'XXX'
,
self
.
getVar
(
'group'
)
)
except
KeyError
:
print
'XXX'
print
(
'XXX'
)
self
.
pullState
()
return
self
.
formatter
.
link
(
formattedText
,
url
)
...
...
@@ -1132,6 +1134,6 @@ def makeHtmlFromSpip(text, simple=0, inline=0, documents=None, **keywords):
if
__name__
==
'__main__'
:
if
os
.
path
.
exists
(
sys
.
argv
[
1
]):
print
makeHtmlFromSpip
(
unicode
(
file
(
sys
.
argv
[
1
]).
read
(),
'utf-8'
))
print
(
makeHtmlFromSpip
(
unicode
(
file
(
sys
.
argv
[
1
]).
read
(),
'utf-8'
)
))
else
:
print
makeHtmlFromSpip
(
unicode
(
sys
.
argv
[
1
],
'utf-8'
))
print
(
makeHtmlFromSpip
(
unicode
(
sys
.
argv
[
1
],
'utf-8'
)
))
emissions/management/commands/create-sound-files.py
View file @
ed3e616d
from
__future__
import
print_function
import
base64
import
mutagen
import
mutagen.mp3
...
...
@@ -85,8 +87,8 @@ class Command(BaseCommand):
cmd
.
append
(
file_path
)
if
self
.
verbose
:
print
'creating'
,
file_path
print
' '
,
' '
.
join
(
cmd
)
print
(
'creating'
,
file_path
)
print
(
' '
,
' '
.
join
(
cmd
)
)
else
:
cmd
[
1
:
1
]
=
[
'-loglevel'
,
'quiet'
]
...
...
emissions/management/commands/day-program.py
View file @
ed3e616d
from
__future__
import
print_function
from
datetime
import
datetime
from
django.core.management.base
import
BaseCommand
,
CommandError
...
...
@@ -13,4 +15,4 @@ class Command(BaseCommand):
year
,
month
,
day
=
date
.
split
(
'-'
)
date
=
datetime
(
int
(
year
),
int
(
month
),
int
(
day
))
for
entry
in
day_program
(
date
):
print
entry
.
datetime
,
entry
print
(
entry
.
datetime
,
entry
)
emissions/management/commands/load-from-spip.py
View file @
ed3e616d
# -*- coding: utf-8 -*-
from
__future__
import
print_function
from
datetime
import
datetime
import
time
import
gzip
...
...
@@ -166,7 +168,7 @@ class Command(BaseCommand):
with
open
(
filename
)
as
fd
:
if
self
.
verbose
:
print
'Reading SPIP dump file'
print
(
'Reading SPIP dump file'
)
content
=
fd
.
read
()
# the spip_courriers parts of the spip export are not properly
# encoded, we manually remove them here so the XML file can be
...
...
@@ -176,7 +178,7 @@ class Command(BaseCommand):
self
.
root
=
ET
.
fromstring
(
content
)
if
self
.
verbose
:
print
'Loading objects from dump'
print
(
'Loading objects from dump'
)
self
.
load_keyword_groups
()
self
.
load_keywords
()
self
.
load_rubrics
()
...
...
@@ -192,11 +194,11 @@ class Command(BaseCommand):
self
.
breves
=
{}
if
not
self
.
article_ids
:
if
self
.
verbose
:
print
' breves...'
print
(
' breves...'
)
self
.
load_breves
()
if
self
.
verbose
:
print
' articles...'
print
(
' articles...'
)
self
.
load_articles
(
emission_rubric_ids
)
self
.
set_urls
()
...
...
@@ -208,11 +210,11 @@ class Command(BaseCommand):
self
.
process_episode_keywords
()
self
.
process_newsitem_keywords
()
print
'Creating emissions'
print
(
'Creating emissions'
)
for
emission_id
in
straight_emission_rubric_ids
:
rubric
=
self
.
rubrics
[
emission_id
]
emission
=
self
.
get_or_create_emission
(
rubric
)
print
' '
,
emission
.
title
print
(
' '
,
emission
.
title
)
if
rewritemap_file
:
self
.
add_rewritemap_entries
(
rubric
,
emission
)
...
...
@@ -225,7 +227,7 @@ class Command(BaseCommand):
self
.
set_sound_files
(
article
,
episode
)
print
'Creating newsitems'
print
(
'Creating newsitems'
)
for
breve
in
self
.
breves
.
values
():
if
breve
.
titre
.
startswith
(
'Cette semaine sur Panik'
):
continue
...
...
@@ -564,9 +566,9 @@ class Command(BaseCommand):
else
:
has_sound
=
'-'
base_spip_edit_url
=
'http://www.radiopanik.org/spip/ecrire/?exec=articles_edit&id_article='
print
>>
self
.
stats_skipped_file
,
unicode
(
'%s
\t
%s
\t
%s
\t
%s%s'
%
(
self
.
stats_skipped_file
.
write
(
unicode
(
'%s
\t
%s
\t
%s
\t
%s%s'
%
(
emission
.
title
,
article
.
titre
,
has_sound
,
base_spip_edit_url
,
article
.
id_article
)).
encode
(
'utf-8'
)
base_spip_edit_url
,
article
.
id_article
)).
encode
(
'utf-8'
)
)
return
None
possible_slugs
=
[
article
.
url
.
lower
()]
...
...
@@ -716,7 +718,7 @@ class Command(BaseCommand):
return
if
self
.
verbose
:
print
' set portfolio on'
,
object
print
(
' set portfolio on'
,
object
)
# get filename, eventually to properly sized images
for
i
,
attached_file
in
enumerate
(
attached_files
):
...
...
@@ -761,5 +763,5 @@ class Command(BaseCommand):
def
write_rewritemap
(
self
,
rewritemap_file
):
fd
=
file
(
rewritemap_file
,
'w'
)
for
src
,
dst
in
self
.
rewritemap
:
print
>>
fd
,
src
,
dst
fd
.
write
(
'%s %s
\n
'
%
(
src
,
dst
))
fd
.
close
()
emissions/management/commands/update-emission.py
View file @
ed3e616d
from
__future__
import
print_function
from
optparse
import
make_option
from
django.core.management.base
import
BaseCommand
,
CommandError
...
...
@@ -24,6 +26,6 @@ class Command(BaseCommand):
try
:
episode
=
Episode
.
objects
.
get
(
slug
=
episode_slug
)
except
Episode
.
DoesNotExist
:
print
'missing episode:'
,
episode
print
(
'missing episode:'
,
episode
)
episode
.
emission
=
emission
episode
.
save
()
emissions/management/commands/week-program.py
View file @
ed3e616d
from
__future__
import
print_function
from
datetime
import
datetime
,
timedelta
from
django.core.management.base
import
BaseCommand
,
CommandError
...
...
@@ -17,4 +19,4 @@ class Command(BaseCommand):
week
,
'%W'
)
date
=
datetime
(
*
date
.
timetuple
()[:
3
])
for
entry
in
period_program
(
date
,
date
+
timedelta
(
days
=
7
)):
print
entry
.
datetime
,
entry
print
(
entry
.
datetime
,
entry
)
emissions/management/commands/whatsonair.py
View file @
ed3e616d
from
__future__
import
print_function
from
django.core.management.base
import
BaseCommand
,
CommandError
from
...utils
import
whatsonair
...
...
@@ -6,6 +8,6 @@ from ...utils import whatsonair
class
Command
(
BaseCommand
):
def
handle
(
self
,
*
args
,
**
options
):
onair
=
whatsonair
()
print
'found episode:'
,
onair
.
get
(
'episode'
)
print
'found emission:'
,
onair
.
get
(
'emission'
)
print
'found nonstop:'
,
onair
.
get
(
'nonstop'
)
print
(
'found episode:'
,
onair
.
get
(
'episode'
)
)
print
(
'found emission:'
,
onair
.
get
(
'emission'
)
)
print
(
'found nonstop:'
,
onair
.
get
(
'nonstop'
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment