Private GIT
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CouchPotatoServer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vlbox
CouchPotatoServer
Commits
94478336
Commit
94478336
authored
Jan 10, 2013
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
RT cleanup
parent
df53d0c5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
couchpotato/core/providers/automation/rottentomatoes/__init__.py
+1
-1
1 addition, 1 deletion
...tato/core/providers/automation/rottentomatoes/__init__.py
couchpotato/core/providers/automation/rottentomatoes/main.py
+22
-32
22 additions, 32 deletions
couchpotato/core/providers/automation/rottentomatoes/main.py
with
23 additions
and
33 deletions
couchpotato/core/providers/automation/rottentomatoes/__init__.py
+
1
−
1
View file @
94478336
...
...
@@ -10,7 +10,7 @@ config = [{
'
tab
'
:
'
automation
'
,
'
name
'
:
'
rottentomatoes_automation
'
,
'
label
'
:
'
Rottentomatoes
'
,
'
description
'
:
'
Imports movies from the rottentomatoes in theaters
rss
feed.
'
,
'
description
'
:
'
Imports movies from the rottentomatoes
"
in theaters
"
-
feed.
'
,
'
options
'
:
[
{
'
name
'
:
'
automation_enabled
'
,
...
...
This diff is collapsed.
Click to expand it.
couchpotato/core/providers/automation/rottentomatoes/main.py
+
22
−
32
View file @
94478336
from
couchpotato.core.helpers.rss
import
RSS
from
couchpotato.core.helpers.variable
import
md5
from
couchpotato.core.helpers.variable
import
tryInt
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.providers.automation.base
import
Automation
from
xml.etree.ElementTree
import
QName
import
datetime
import
xml.etree.ElementTree
as
XMLTree
import
re
log
=
CPLog
(
__name__
)
...
...
@@ -12,24 +11,17 @@ log = CPLog(__name__)
class
Rottentomatoes
(
Automation
,
RSS
):
interval
=
1800
rss_url
=
'
http://www.rottentomatoes.com/syndication/rss/in_theaters.xml
'
urls
=
{
'
namespace
'
:
'
http://www.rottentomatoes.com/xmlns/rtmovie/
'
,
'
theater
'
:
'
http://www.rottentomatoes.com/syndication/rss/in_theaters.xml
'
,
}
def
getIMDBids
(
self
):
if
self
.
isDisabled
():
return
movies
=
[]
cache_key
=
'
rottentomatoes.%s
'
%
md5
(
self
.
rss_url
)
rss_data
=
self
.
getCache
(
cache_key
,
self
.
rss_url
)
data
=
XMLTree
.
fromstring
(
rss_data
)
if
data
:
namespace
=
'
http://www.rottentomatoes.com/xmlns/rtmovie/
'
rating_tag
=
str
(
QName
(
namespace
,
'
tomatometer_percent
'
))
rss_movies
=
self
.
getElements
(
data
,
'
channel/item
'
)
rss_movies
=
self
.
getRSSData
(
self
.
urls
[
'
theater
'
])
rating_tag
=
str
(
QName
(
self
.
urls
[
'
namespace
'
],
'
tomatometer_percent
'
))
for
movie
in
rss_movies
:
...
...
@@ -38,17 +30,15 @@ class Rottentomatoes(Automation, RSS):
if
result
:
log
.
info
(
'
Something smells...
'
)
rating
=
i
nt
(
self
.
getTextElement
(
movie
,
rating_tag
))
log
.
info
2
(
'
Something smells...
'
)
rating
=
tryI
nt
(
self
.
getTextElement
(
movie
,
rating_tag
))
name
=
result
.
group
(
0
)
if
rating
<
int
(
self
.
conf
(
'
tomatometer_percent
'
)):
log
.
info
(
'
%s seems to be rotten...
'
%
name
)
if
rating
<
tryInt
(
self
.
conf
(
'
tomatometer_percent
'
)):
log
.
info2
(
'
%s seems to be rotten...
'
%
name
)
else
:
log
.
info
(
'
Y
ou
fi
nd %s fresh enough
though
, enqueuing: %s
'
%
(
rating
,
name
))
log
.
info
2
(
'
F
ound %s fresh enough
movies
, enqueuing: %s
'
%
(
rating
,
name
))
year
=
datetime
.
datetime
.
now
().
strftime
(
"
%Y
"
)
imdb
=
self
.
search
(
name
,
year
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment