Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10601 > unrolled thread

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

Started byAndrew Berg <bahamutzero8825@gmail.com>
First post2011-07-30 16:57 -0500
Last post2011-07-30 16:57 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Deeply nested dictionaries - should I look into a database or am I just doing it wrong? Andrew Berg <bahamutzero8825@gmail.com> - 2011-07-30 16:57 -0500

#10601 — Deeply nested dictionaries - should I look into a database or am I just doing it wrong?

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2011-07-30 16:57 -0500
SubjectDeeply nested dictionaries - should I look into a database or am I just doing it wrong?
Message-ID<mailman.1676.1312063033.1164.python-list@python.org>
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.

-- 
CPython 3.2.1 | Windows NT 6.1.7601.17592 | Thunderbird 5.0
PGP/GPG Public Key ID: 0xF88E034060A78FCB

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web