3 #include "awindowgui.inc"
10 #include "filesystem.h"
11 #include "indexfile.h"
12 #include "quicktime.h"
13 #include "mainsession.h"
14 #include "threadindexer.h"
17 Assets::Assets(EDL *edl) : List<Asset>()
27 int Assets::load(ArrayList<PluginServer*> *plugindb,
33 //printf("Assets::load 1\n");
36 result = file->read_tag();
39 if(file->tag.title_is("/ASSETS"))
44 if(file->tag.title_is("ASSET"))
46 //printf("Assets::load 2\n");
47 char *path = file->tag.get_property("SRC");
48 //printf("Assets::load 3\n");
49 Asset *new_asset = new Asset(path ? path : SILENCE);
50 //printf("Assets::load 4\n");
51 new_asset->read(file);
52 //printf("Assets::load 5\n");
54 Garbage::delete_object(new_asset);
55 //printf("Assets::load 6\n");
59 //printf("Assets::load 7\n");
63 int Assets::save(ArrayList<PluginServer*> *plugindb, FileXML *file, char *path)
65 file->tag.set_title("ASSETS");
67 file->append_newline();
69 for(Asset* current = first; current; current = NEXT)
76 file->tag.set_title("/ASSETS");
78 file->append_newline();
79 file->append_newline();
83 void Assets::copy_from(Assets *assets)
87 for(Asset *current = assets->first; current; current = NEXT)
90 append(new_asset = new Asset);
91 new_asset->copy_from(current, 1);
95 Assets& Assets::operator=(Assets &assets)
97 printf("Assets::operator= 1\n");
103 void Assets::update_index(Asset *asset)
105 for(Asset* current = first; current; current = NEXT)
107 if(current->test_path(asset->path))
109 current->update_index(asset);
114 Asset* Assets::update(Asset *asset)
118 for(Asset* current = first; current; current = NEXT)
120 // Asset already exists.
121 if(current->test_path(asset->path))
127 // Asset doesn't exist.
128 Asset *asset_copy = new Asset(*asset);
133 int Assets::delete_all()
142 Asset* Assets::update(const char *path)
144 Asset* current = first;
148 if(current->test_path(path))
155 return append(new Asset(path));
158 Asset* Assets::get_asset(const char *filename)
160 Asset* current = first;
165 //printf("Assets::get_asset %p %s\n", filename, filename);
166 if(current->test_path(filename))
171 current = current->next;
177 Asset* Assets::remove_asset(Asset *asset)
179 remove_pointer(asset);
180 Garbage::delete_object(asset);
184 int Assets::number_of(Asset *asset)
189 for(i = 0, current = first; current && current != asset; i++, current = NEXT)
195 Asset* Assets::asset_number(int number)
200 for(i = 0, current = first; i < number && current; i++, current = NEXT)
206 int Assets::update_old_filename(char *old_filename, char *new_filename)
208 for(Asset* current = first; current; current = NEXT)
210 if(!strcmp(current->path, old_filename))
212 current->update_path(new_filename);
221 for(Asset *current = first; current; current = NEXT)