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
5bda44d4
Commit
5bda44d4
authored
Oct 20, 2012
by
Ruud
Browse files
Options
Downloads
Patches
Plain Diff
Add api for file types
parent
84eccbf9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
couchpotato/core/plugins/file/main.py
+28
-0
28 additions, 0 deletions
couchpotato/core/plugins/file/main.py
with
28 additions
and
0 deletions
couchpotato/core/plugins/file/main.py
+
28
−
0
View file @
5bda44d4
...
...
@@ -2,6 +2,7 @@ from couchpotato import get_session
from
couchpotato.api
import
addApiView
from
couchpotato.core.event
import
addEvent
from
couchpotato.core.helpers.encoding
import
toUnicode
from
couchpotato.core.helpers.request
import
jsonified
from
couchpotato.core.helpers.variable
import
md5
,
getExt
from
couchpotato.core.logger
import
CPLog
from
couchpotato.core.plugins.base
import
Plugin
...
...
@@ -30,6 +31,27 @@ class FileManager(Plugin):
'
return
'
:
{
'
type
'
:
'
file
'
}
})
addApiView
(
'
file.types
'
,
self
.
getTypesView
,
docs
=
{
'
desc
'
:
'
Return a list of all the file types and their ids.
'
,
'
return
'
:
{
'
type
'
:
'
object
'
,
'
example
'
:
"""
{
'
types
'
: [
{
"
identifier
"
:
"
poster_original
"
,
"
type
"
:
"
image
"
,
"
id
"
: 1,
"
name
"
:
"
Poster_original
"
},
{
"
identifier
"
:
"
poster
"
,
"
type
"
:
"
image
"
,
"
id
"
: 2,
"
name
"
:
"
Poster
"
},
etc
]
}
"""
}
})
addEvent
(
'
app.load
'
,
self
.
cleanup
)
addEvent
(
'
app.load
'
,
self
.
init
)
...
...
@@ -129,3 +151,9 @@ class FileManager(Plugin):
types
.
append
(
type_object
.
to_dict
())
return
types
def
getTypesView
(
self
):
return
jsonified
({
'
types
'
:
self
.
getTypes
()
})
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