12 AdCuts(int pid, int fd, const char *fn)
16 memset(this->filename,0,sizeof(this->filename));
17 if( fn ) strcpy(this->filename,fn);
26 char cut_filename[BCTEXTLEN];
27 strcpy(cut_filename, filename);
28 strcpy(strrchr(cut_filename, '.'),".cut");
29 write_cuts(cut_filename);
30 printf(_("cuts to %s complete\n"),cut_filename);
41 if( xml.read_tag() != 0 ) return 1;
42 if( !xml.tag.title_is("CUT") ) break;
43 double time = xml.tag.get_property("TIME", (double)0.0);
44 int action = xml.tag.get_property("ACTION", (int)0);
45 append(new AdCut(time, action));
51 read_cuts(const char *filename)
54 if( xml.read_from_file(filename, 1) ) return 0;
56 if( xml.read_tag() ) return 0;
57 } while( !xml.tag.title_is("CUTS") );
59 int pid = xml.tag.get_property("PID", (int)-1);
60 const char *file = xml.tag.get_property("FILE");
61 AdCuts *cuts = new AdCuts(pid, -1, file);
62 if( cuts->load(xml) || !xml.tag.title_is("/CUTS") ) {
63 delete cuts; cuts = 0;
71 xml.tag.set_title("CUTS");
72 xml.tag.set_property("PID", pid);
73 xml.tag.set_property("FILE", filename);
77 for( AdCut *cut=first; cut; cut=cut->next ) {
78 xml.tag.set_title("CUT");
79 xml.tag.set_property("TIME", cut->time);
80 xml.tag.set_property("ACTION", cut->action);
82 xml.tag.set_title("/CUT");
87 xml.tag.set_title("/CUTS");
94 write_cuts(const char *filename)
96 FILE *fp = fopen(filename, "wb");
100 xml.terminate_string();
101 xml.write_to_file(fp);