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
f7911fe9
Commit
f7911fe9
authored
Dec 18, 2012
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
Remove release on new scan
parent
8ffa6a83
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
couchpotato/core/plugins/manage/main.py
+28
-5
28 additions, 5 deletions
couchpotato/core/plugins/manage/main.py
couchpotato/core/settings/model.py
+1
-1
1 addition, 1 deletion
couchpotato/core/settings/model.py
with
29 additions
and
6 deletions
couchpotato/core/plugins/manage/main.py
+
28
−
5
View file @
f7911fe9
...
...
@@ -115,13 +115,36 @@ class Manage(Plugin):
if
done_movie
[
'
library
'
][
'
identifier
'
]
not
in
added_identifiers
:
fireEvent
(
'
movie.delete
'
,
movie_id
=
done_movie
[
'
id
'
],
delete_from
=
'
all
'
)
else
:
for
release
in
done_movie
.
get
(
'
releases
'
,
[]):
if
len
(
release
.
get
(
'
files
'
,
[]))
==
0
:
fireEvent
(
'
release.delete
'
,
release
[
'
id
'
])
else
:
for
release_file
in
release
.
get
(
'
files
'
,
[]):
# Remove release not available anymore
if
not
os
.
path
.
isfile
(
ss
(
release_file
[
'
path
'
])):
fireEvent
(
'
release.clean
'
,
release
[
'
id
'
])
break
# Check if there are duplicate releases (different quality) use the last one, delete the rest
if
len
(
done_movie
.
get
(
'
releases
'
,
[]))
>
1
:
used_files
=
{}
for
release
in
done_movie
.
get
(
'
releases
'
,
[]):
for
release_file
in
release
.
get
(
'
files
'
,
[]):
already_used
=
used_files
.
get
(
release_file
[
'
path
'
])
if
already_used
:
print
already_used
,
release
[
'
id
'
]
if
already_used
<
release
[
'
id
'
]:
fireEvent
(
'
release.delete
'
,
release
[
'
id
'
],
single
=
True
)
# delete this one
else
:
fireEvent
(
'
release.delete
'
,
already_used
,
single
=
True
)
# delete previous one
break
else
:
used_files
[
release_file
[
'
path
'
]]
=
release
.
get
(
'
id
'
)
del
used_files
Env
.
prop
(
'
manage.last_update
'
,
time
.
time
())
except
:
log
.
error
(
'
Failed updating library: %s
'
,
(
traceback
.
format_exc
()))
...
...
This diff is collapsed.
Click to expand it.
couchpotato/core/settings/model.py
+
1
−
1
View file @
f7911fe9
...
...
@@ -100,7 +100,7 @@ class Release(Entity):
movie
=
ManyToOne
(
'
Movie
'
)
status
=
ManyToOne
(
'
Status
'
)
quality
=
ManyToOne
(
'
Quality
'
)
files
=
ManyToMany
(
'
File
'
,
cascade
=
'
all, delete-orphan
'
,
single_parent
=
True
)
files
=
ManyToMany
(
'
File
'
)
info
=
OneToMany
(
'
ReleaseInfo
'
,
cascade
=
'
all, delete-orphan
'
)
def
to_dict
(
self
,
deep
=
{},
exclude
=
[]):
...
...
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