Deeply nested dictionaries - should I look into a database or amI just doing it wrong?

A

Andrew Berg

As part of my muxer/encoder backend module, I need to store data in its
main class. While each instance won't typically store a lot of data, but
I really want it broken up into distinct categories so that a program
using the module won't need to figure out what piece of data refers to
what (e.g. is the current item using yadif via FFmpeg or AviSynth?) and
so that methods can be configured not to accept data that isn't relevant
(e.g. I don't want a bug in the calling program to cause the module to
use AviSynth methods if the user wants to use FFmpeg; I'd rather raise
an exception in this case). This is my (incomplete) layout of how I'd
nest the dictionaries:
main
demuxer
video_encoder
audio_encoder
muxer
io
input_file
prefix
output_file
video
enabled
mode (pal/ntsc/ivtc/film)
fps
fpsr
fpsd
fpsin
fpsout
audio
enabled
type (copy/aac/mp3/(l)pcm/etc.)
avs
enabled
location
dll
plugins
demuxer
type (DirectShowSource/AVISource/etc.)
dss_opts
avis_opts

filter
deint/ivtc/none
yadif
enabled
opts
titvc
enabled
tdopts
tfmopts
fft3d
enabled/gpu
ffte
ffts
tsmuxer
enabled
location
meta (T/F)
x264
enabled
location
usepreset (use presets or specify commands explicitly?)
rcmethod
crf
bitrate
cur_pass
total_pass
turbo (check x264 docs!)
keyint
min_keyint


sox
enabled
location
vol
ffmpeg
enabled
location
audio/video/both
video
x264

audio
acodec

Top-level items in the namespace of the object (e.g. QueueItem.x264).
Deeper are dictionaries within (e.g.
QueueItem.x264['avs']['filter']['fft3d']['ffte']).
Some of these can nest pretty deeply, so I wonder if dictionaries are
the right way to go.
 

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top