Skip to content

Commit

Permalink
encoder: invenio.config deprecation
Browse files Browse the repository at this point in the history
* Replaces usage of invenio.config with invenio.base.globals:cfg.
  (addresses inveniosoftware#3106)

Signed-off-by: Leonardo Rossi <[email protected]>
  • Loading branch information
Leonardo Rossi committed Jul 23, 2015
1 parent 294bdf9 commit 6241def
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions invenio/modules/encoder/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

from six import iteritems

from invenio.base.globals import cfg
from invenio.legacy.bibsched.bibtask import (
write_message,
task_update_progress,
Expand All @@ -43,7 +44,6 @@
ffprobe_metadata,
mediainfo_metadata
)
from invenio.config import CFG_PATH_FFMPEG
import time
import os
import subprocess
Expand Down Expand Up @@ -371,14 +371,14 @@ def insert(key, value):
## Determine base command arguments from the pass to run
base_args = None
if passes == 1:
base_args = [CFG_PATH_FFMPEG, '-y', '-i', input_file, output_file]
base_args = [cfg['CFG_PATH_FFMPEG'], '-y', '-i', input_file, output_file]
elif passes == 2:
if nofpass == 1:
base_args = [CFG_PATH_FFMPEG, '-y', '-i', input_file,
base_args = [cfg['CFG_PATH_FFMPEG'], '-y', '-i', input_file,
'-pass', '1', '-passlogfile', pass_log_file,
'-an', '-f', 'rawvideo', '/dev/null']
elif nofpass == 2:
base_args = [CFG_PATH_FFMPEG, '-y', '-i', input_file,
base_args = [cfg['CFG_PATH_FFMPEG'], '-y', '-i', input_file,
'-pass', '2', '-passlogfile',
pass_log_file, output_file]
## Insert additional arguments
Expand Down
4 changes: 2 additions & 2 deletions invenio/modules/encoder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def uuid4():
CFG_BIBENCODE_FFMPEG_CONFIGURATION_REQUIRED,
CFG_BIBENCODE_MEDIAINFO_COMMAND
)
from invenio.config import CFG_PATH_FFPROBE
from invenio.base.globals import cfg

# The timestamp for the process. Used to identify Logfiles.
def generate_timestamp():
Expand Down Expand Up @@ -242,7 +242,7 @@ def check_ffmpeg_configuration():
"""
## Use ffprobe to get the current ffmpeg configuration
try:
process = subprocess.Popen(CFG_PATH_FFPROBE, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
process = subprocess.Popen(cfg['CFG_PATH_FFPROBE'], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
except OSError:
return ["FFMPEG/FFPROBE does not seem to be installed!"]
returncode = process.wait()
Expand Down
6 changes: 3 additions & 3 deletions invenio/modules/encoder/websubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
import os
import pkg_resources

from invenio.base.globals import cfg
from invenio.modules.encoder.config import (
CFG_BIBENCODE_WEBSUBMIT_ASPECT_SAMPLE_DIR,
CFG_BIBENCODE_WEBSUBMIT_ASPECT_SAMPLE_FNAME
)
from invenio.config import CFG_SITE_URL, CFG_PYLIBDIR

def gcd(a,b):
""" the euclidean algorithm """
Expand Down Expand Up @@ -95,11 +95,11 @@ def websubmit_singlepage(curdir, doctype, uid, access, session_id):
else:
resume = "false"
body = form_body() % {
'CFG_SITE_URL' : CFG_SITE_URL,
'CFG_SITE_URL' : cfg['CFG_SITE_URL'],
'guidelines_url': "localhost"
}
javascript = form_javascript() % {
'CFG_SITE_URL' : CFG_SITE_URL,
'CFG_SITE_URL' : cfg['CFG_SITE_URL'],
'indir': indir,
'doctype': doctype,
'access': access,
Expand Down

0 comments on commit 6241def

Please sign in to comment.