9 original_old_dir
= "test/files/norerecordold"
10 old_dir
= "test/files/norerecordold-copy"
11 converted_dir
= "test/files/norerecordconv"
13 def get_dir_tree( dr
):
15 for (dirpath
, dirnames
, filenames
) in os
.walk( dr
):
16 ret
[dirpath
] = filenames
19 def test_slow_find_old_programmes_map():
21 if os
.path
.isdir( old_dir
):
22 shutil
.rmtree( old_dir
)
24 shutil
.copytree( original_old_dir
, old_dir
)
26 sch
= rtv_schedule
.Schedule( None )
28 old_converted_tree
= get_dir_tree( converted_dir
)
30 mp
= sch
.find_old_programmes_map( old_dir
, converted_dir
)
32 # We found the right titles and sub-titles
34 "Pocoyo" : { "Pato's Paintings" : 1,
35 "Monster Mystery" : 1, },
36 "The West Wing" : { "In the Room" : 1, },
37 "Thomas and Friends" : { "A Smooth Ride" : 1, },
40 # We deleted the rtvinfos that didn't contain sub-titles
41 # or did contain unique_subtitles=False
42 dr_list
= os
.listdir( old_dir
)
46 "2008-10-10_Pato_s_Paintings.rtvinfo",
47 "2008-10-13_Monster_Mystery.rtvinfo",
48 "2008-11-16_In_the_Room.rtvinfo",
51 new_converted_tree
= get_dir_tree( converted_dir
)
53 assert( old_converted_tree
== new_converted_tree
)
55 shutil
.rmtree( old_dir
)
59 test_slow_find_old_programmes_map()