From: Jos v.d.V. <jo...@us...> - 2006-07-19 15:25:32
|
Update of /cvsroot/win32forth/win32forth/apps/Player4 In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv14287/apps/Player4 Modified Files: Catalog.f Commands.f Mediatree.f Pl_MciWindow.f Pl_Version.f mshell_r.f Log Message: Jos: The catalog now only adds a new record to the catalog when it is not a duplicate. 2 records are considered to be duplicate when the medialabel, relative filename and filesize are the same. Index: mshell_r.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/mshell_r.f,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mshell_r.f 8 Mar 2006 21:42:56 -0000 1.3 --- mshell_r.f 19 Jul 2006 15:25:26 -0000 1.4 *************** *** 14,18 **** \ The number of keys is only limited by the unused size of the stack. \ Each key can be sorted in an ascending or descending way. ! \ A key may contain a number or a string. \ The sort is case-insensitive for stings. \ Easy to expand to sort doubles etc. --- 14,18 ---- \ The number of keys is only limited by the unused size of the stack. \ Each key can be sorted in an ascending or descending way. ! \ A key may contain a byte, word, cell, float or a string. \ The sort is case-insensitive for stings. \ Easy to expand to sort doubles etc. *************** *** 86,91 **** f2dup f= if f2drop 0 else f< if 1 else true then then ; ! : cmp-cells ( cand1 cand2 by - n ) locals| by | >key @ swap >key @ <>= ; : cmp-words ( cand1 cand2 by - n ) locals| by | >key w@ swap >key w@ <>= ; : cmp-floats ( cand1 cand2 by - n ) locals| by | >key f@ >key f@ f<>= ; --- 86,92 ---- f2dup f= if f2drop 0 else f< if 1 else true then then ; ! : cmp-bytes ( cand1 cand2 by - n ) locals| by | >key c@ swap >key c@ <>= ; : cmp-words ( cand1 cand2 by - n ) locals| by | >key w@ swap >key w@ <>= ; + : cmp-cells ( cand1 cand2 by - n ) locals| by | >key @ swap >key @ <>= ; : cmp-floats ( cand1 cand2 by - n ) locals| by | >key f@ >key f@ f<>= ; *************** *** 97,102 **** : Descending ( key - key ) dup -1 2 mod-cell ; : $sort ( key - ) ['] cmp$ 3 mod-cell ; ! : bin-sort ( key - ) ['] cmp-cells 3 mod-cell ; : word-sort ( key - ) ['] cmp-words 3 mod-cell ; : float-sort ( key - ) ['] cmp-floats 3 mod-cell ; --- 98,104 ---- : Descending ( key - key ) dup -1 2 mod-cell ; : $sort ( key - ) ['] cmp$ 3 mod-cell ; ! : byte-sort ( key - ) ['] cmp-bytes 3 mod-cell ; : word-sort ( key - ) ['] cmp-words 3 mod-cell ; + : bin-sort ( key - ) ['] cmp-cells 3 mod-cell ; : float-sort ( key - ) ['] cmp-floats 3 mod-cell ; Index: Pl_Version.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/Pl_Version.f,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Pl_Version.f 8 Jul 2006 19:58:52 -0000 1.19 --- Pl_Version.f 19 Jul 2006 15:25:26 -0000 1.20 *************** *** 3,7 **** anew -Pl_Version.f ! 10126 value player_version# \ Version numbers: v.ww.rr --- 3,7 ---- anew -Pl_Version.f ! 10127 value player_version# \ Version numbers: v.ww.rr *************** *** 39,43 **** - Create *.m3u files and import them the catalog - Columns in the treeview. - - Only add a new file to the catalog when it wasn't added before \ --------------------------------------------------------------------------- --- 39,42 ---- *************** *** 178,179 **** --- 177,186 ---- Jos: July 8th, 2006. File names will now be relative stored when a search path is filled. + + \ changes for Version 1.01.27 + Jos: July 19th, 2006. + The catalog now only adds a new record to the catalog when it is not a duplicate. + 2 records are considered to be duplicate when the + medialabel, relative filename and filesize are the same. + + Index: Catalog.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/Catalog.f,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** Catalog.f 8 Jul 2006 19:58:52 -0000 1.37 --- Catalog.f 19 Jul 2006 15:25:26 -0000 1.38 *************** *** 335,338 **** --- 335,339 ---- ; + /artist /album + /Title + constant /Record 0 RecordDef File_name previous /file_name key: FileNameKey *************** *** 340,351 **** 0 RecordDef RandomLevel previous 1 cells key: RandomKey RandomKey bin-sort 0 RecordDef #played previous 1 cells key: leastPlayedKey leastPlayedKey bin-sort 0 RecordDef FileSize previous 1 cells key: FileSizeKey FileSizeKey bin-sort 0 RecordDef Request- previous 1 cells 2/ key: RequestKey RequestKey Descending word-sort : &FlexKeyLen ( - &FlexKeyLen ) FlexKey &key-len ; : MinFlexKey! ( n - ) min FlexKey ! ; - /artist /album + /Title + constant /Record - : by_record ( - FlexKey ) /Record &FlexKeyLen ! FlexKey @ 0 RecordDef Artist MinFlexKey! FlexKey --- 341,352 ---- 0 RecordDef RandomLevel previous 1 cells key: RandomKey RandomKey bin-sort 0 RecordDef #played previous 1 cells key: leastPlayedKey leastPlayedKey bin-sort + 0 RecordDef Deleted- previous 1 key: DeletedKey DeletedKey byte-sort 0 RecordDef FileSize previous 1 cells key: FileSizeKey FileSizeKey bin-sort 0 RecordDef Request- previous 1 cells 2/ key: RequestKey RequestKey Descending word-sort + 0 RecordDef MediaLabel previous /MediaLabel /Record + key: LabelKey : &FlexKeyLen ( - &FlexKeyLen ) FlexKey &key-len ; : MinFlexKey! ( n - ) min FlexKey ! ; : by_record ( - FlexKey ) /Record &FlexKeyLen ! FlexKey @ 0 RecordDef Artist MinFlexKey! FlexKey *************** *** 362,368 **** --- 363,373 ---- : by_leastPlayed ( - by ) by[ leastPlayedKey Ascending RequestKeyFlagged ]by ; : by_FileSize ( - by ) by[ FileSizeKey RequestKeyFlagged ]by ; + : by_cand_duplicates ( - by ) by[ leastPlayedKey Ascending FileSizeKey + FileNameKey LabelKey DeletedKey ]by ; : not-deleted? ( rec-adr - flag ) s" RecordDef deleted- c@ 0= " EVALUATE ; IMMEDIATE + :inline FileSizeRecord ( adr - FileSizeRecord ) RecordDef FileSize @ ; + : _list-record ( rec-adr - ) dup>r not-deleted? *************** *** 380,384 **** r@ RecordDef Played- c@ . r@ RecordDef Excluded- c@ . ! r@ RecordDef FileSize @ 12 U,.R r@ RecordDef RequestLevelRecord c@ ." Req " . then --- 385,389 ---- r@ RecordDef Played- c@ . r@ RecordDef Excluded- c@ . ! r@ FileSizeRecord 12 U,.R r@ RecordDef RequestLevelRecord c@ ." Req " . then *************** *** 425,429 **** r@ RecordDef Title r@ Cnt_Title c@ type-separator r@ RecordDef #played @ .csv type-separator ! r@ RecordDef FileSize @ .csv type-separator r@ RecordDef RequestLevelRecord c@ .csv +inlineRecord InlineRecord count fwrite --- 430,434 ---- r@ RecordDef Title r@ Cnt_Title c@ type-separator r@ RecordDef #played @ .csv type-separator ! r@ FileSizeRecord .csv type-separator r@ RecordDef RequestLevelRecord c@ .csv +inlineRecord InlineRecord count fwrite *************** *** 459,465 **** ; ! : sort_by_filename ( - ) by_FileName sort-database ; ! : sort_by_leastPlayed ( - ) by_leastPlayed sort-database ; ! : sort_by_size ( - ) by_FileSize sort-database ; : SortByFlags ( - ) --- 464,471 ---- ; ! : sort_by_filename ( - ) by_FileName sort-database ; ! : sort_by_leastPlayed ( - ) by_leastPlayed sort-database ; ! : sort_by_size ( - ) by_FileSize sort-database ; ! : sort_by_cand_duplicates ( - ) by_cand_duplicates sort-database ; : SortByFlags ( - ) *************** *** 672,675 **** --- 678,711 ---- external + \ 2 records are considered to be duplicate when the + \ medialabel, relative filename and filesize are the same + + : duplicates? { rec1 rec2 } ( rec rec+1 - f ) + rec1 FileSizeRecord rec2 FileSizeRecord = + if rec1 RecordDef MediaLabel rec1 RecordDef Cnt_MediaLabel c@ + rec2 RecordDef MediaLabel rec2 RecordDef Cnt_MediaLabel c@ compareia 0= + if rec1 RecordDef File_name rec1 RecordDef Cnt_File_name c@ + rec2 RecordDef File_name rec2 RecordDef Cnt_File_name c@ compareia 0= + else false + then + else false + then + ; + + : DuplicatedToNext? ( n - f ) dup n>record swap 1+ n>record duplicates? ; + + : RemoveDuplicates ( - ) + sort_by_cand_duplicates + database-mhndl #records-in-database 1- 0 + ?do i n>record in-freelist? + if leave + then + i DuplicatedToNext? + if i delete-record + then + loop + SortByFlags + ; + : CloseReMap ( wHndl - ) close-file abort" Close error database" *************** *** 686,689 **** --- 722,726 ---- select_tree sdir CloseReMap + RemoveDuplicates arrow-cursor ; Index: Mediatree.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/Mediatree.f,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Mediatree.f 28 Jun 2006 11:43:12 -0000 1.34 --- Mediatree.f 19 Jul 2006 15:25:26 -0000 1.35 *************** *** 320,323 **** --- 320,324 ---- 2drop hDrop Call DragFinish wHndl CloseReMap + RemoveDuplicates RefreshCatalog ; Index: Pl_MciWindow.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/Pl_MciWindow.f,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Pl_MciWindow.f 8 Jul 2006 19:58:52 -0000 1.26 --- Pl_MciWindow.f 19 Jul 2006 15:25:26 -0000 1.27 *************** *** 315,320 **** #SelectedFiles: GetFilesDialog wait-cursor 0 ! do dup i GetFile: GetFilesDialog AddFile ! loop arrow-cursor CloseReMap RefreshCatalog then ;M --- 315,321 ---- #SelectedFiles: GetFilesDialog wait-cursor 0 ! do dup i GetFile: GetFilesDialog AddFile ! loop ! RemoveDuplicates arrow-cursor CloseReMap RefreshCatalog then ;M Index: Commands.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Player4/Commands.f,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Commands.f 8 Jul 2006 19:58:52 -0000 1.5 --- Commands.f 19 Jul 2006 15:25:26 -0000 1.6 *************** *** 58,61 **** --- 58,62 ---- catalog-exist? if 0 to last-selected-rec player-base search-records + SortByFlags then ; |