diff options
Diffstat (limited to 'apps/tagtree.c')
-rw-r--r-- | apps/tagtree.c | 414 |
1 files changed, 207 insertions, 207 deletions
diff --git a/apps/tagtree.c b/apps/tagtree.c index 5766d2892e..6b0c6aa3dd 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c | |||
@@ -19,7 +19,7 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Basic structure on this file was copied from dbtree.c and modified to | 23 | * Basic structure on this file was copied from dbtree.c and modified to |
24 | * support the tag cache interface. | 24 | * support the tag cache interface. |
25 | */ | 25 | */ |
@@ -117,13 +117,13 @@ static bool sort_inverse; | |||
117 | 117 | ||
118 | /* | 118 | /* |
119 | * "%3d. %s" autoscore title %sort = "inverse" %limit = "100" | 119 | * "%3d. %s" autoscore title %sort = "inverse" %limit = "100" |
120 | * | 120 | * |
121 | * valid = true | 121 | * valid = true |
122 | * formatstr = "%-3d. %s" | 122 | * formatstr = "%-3d. %s" |
123 | * tags[0] = tag_autoscore | 123 | * tags[0] = tag_autoscore |
124 | * tags[1] = tag_title | 124 | * tags[1] = tag_title |
125 | * tag_count = 2 | 125 | * tag_count = 2 |
126 | * | 126 | * |
127 | * limit = 100 | 127 | * limit = 100 |
128 | * sort_inverse = true | 128 | * sort_inverse = true |
129 | */ | 129 | */ |
@@ -135,7 +135,7 @@ struct display_format { | |||
135 | int group_id; | 135 | int group_id; |
136 | int tags[MAX_TAGS]; | 136 | int tags[MAX_TAGS]; |
137 | int tag_count; | 137 | int tag_count; |
138 | 138 | ||
139 | int limit; | 139 | int limit; |
140 | int strip; | 140 | int strip; |
141 | bool sort_inverse; | 141 | bool sort_inverse; |
@@ -288,17 +288,17 @@ static int get_token_str(char *buf, int size) | |||
288 | 288 | ||
289 | if (*strp == '\0' || *(++strp) == '\0') | 289 | if (*strp == '\0' || *(++strp) == '\0') |
290 | return -1; | 290 | return -1; |
291 | 291 | ||
292 | /* Read the data. */ | 292 | /* Read the data. */ |
293 | while (*strp != '"' && *strp != '\0' && --size > 0) | 293 | while (*strp != '"' && *strp != '\0' && --size > 0) |
294 | *(buf++) = *(strp++); | 294 | *(buf++) = *(strp++); |
295 | 295 | ||
296 | *buf = '\0'; | 296 | *buf = '\0'; |
297 | if (*strp != '"') | 297 | if (*strp != '"') |
298 | return -2; | 298 | return -2; |
299 | 299 | ||
300 | strp++; | 300 | strp++; |
301 | 301 | ||
302 | return 0; | 302 | return 0; |
303 | } | 303 | } |
304 | 304 | ||
@@ -345,11 +345,11 @@ static int get_tag(int *tag) | |||
345 | }; | 345 | }; |
346 | char buf[128]; | 346 | char buf[128]; |
347 | unsigned int i; | 347 | unsigned int i; |
348 | 348 | ||
349 | /* Find the start. */ | 349 | /* Find the start. */ |
350 | while ((*strp == ' ' || *strp == '>') && *strp != '\0') | 350 | while ((*strp == ' ' || *strp == '>') && *strp != '\0') |
351 | strp++; | 351 | strp++; |
352 | 352 | ||
353 | if (*strp == '\0' || *strp == '?') | 353 | if (*strp == '\0' || *strp == '?') |
354 | return 0; | 354 | return 0; |
355 | 355 | ||
@@ -433,16 +433,16 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
433 | { | 433 | { |
434 | char buf[SEARCHSTR_SIZE]; | 434 | char buf[SEARCHSTR_SIZE]; |
435 | unsigned int i; | 435 | unsigned int i; |
436 | 436 | ||
437 | if (get_tag(&clause->tag) <= 0) | 437 | if (get_tag(&clause->tag) <= 0) |
438 | return false; | 438 | return false; |
439 | 439 | ||
440 | if (get_clause(&clause->type) <= 0) | 440 | if (get_clause(&clause->type) <= 0) |
441 | return false; | 441 | return false; |
442 | 442 | ||
443 | if (get_token_str(buf, sizeof buf) < 0) | 443 | if (get_token_str(buf, sizeof buf) < 0) |
444 | return false; | 444 | return false; |
445 | 445 | ||
446 | for (i=0; i<ARRAYLEN(id3_to_search_mapping); i++) | 446 | for (i=0; i<ARRAYLEN(id3_to_search_mapping); i++) |
447 | { | 447 | { |
448 | if (!strcasecmp(buf, id3_to_search_mapping[i].string)) | 448 | if (!strcasecmp(buf, id3_to_search_mapping[i].string)) |
@@ -453,13 +453,13 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
453 | { | 453 | { |
454 | clause->source = source_runtime+i; | 454 | clause->source = source_runtime+i; |
455 | clause->str = tagtree_alloc(SEARCHSTR_SIZE); | 455 | clause->str = tagtree_alloc(SEARCHSTR_SIZE); |
456 | } | 456 | } |
457 | else | 457 | else |
458 | { | 458 | { |
459 | clause->source = source_constant; | 459 | clause->source = source_constant; |
460 | clause->str = tagtree_strdup(buf); | 460 | clause->str = tagtree_strdup(buf); |
461 | } | 461 | } |
462 | 462 | ||
463 | if (TAGCACHE_IS_NUMERIC(clause->tag)) | 463 | if (TAGCACHE_IS_NUMERIC(clause->tag)) |
464 | { | 464 | { |
465 | clause->numeric = true; | 465 | clause->numeric = true; |
@@ -468,24 +468,24 @@ static bool read_clause(struct tagcache_search_clause *clause) | |||
468 | else | 468 | else |
469 | clause->numeric = false; | 469 | clause->numeric = false; |
470 | 470 | ||
471 | logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str); | 471 | logf("got clause: %d/%d [%s]", clause->tag, clause->type, clause->str); |
472 | 472 | ||
473 | return true; | 473 | return true; |
474 | } | 474 | } |
475 | 475 | ||
476 | static bool read_variable(char *buf, int size) | 476 | static bool read_variable(char *buf, int size) |
477 | { | 477 | { |
478 | int condition; | 478 | int condition; |
479 | 479 | ||
480 | if (!get_clause(&condition)) | 480 | if (!get_clause(&condition)) |
481 | return false; | 481 | return false; |
482 | 482 | ||
483 | if (condition != clause_is) | 483 | if (condition != clause_is) |
484 | return false; | 484 | return false; |
485 | 485 | ||
486 | if (get_token_str(buf, size) < 0) | 486 | if (get_token_str(buf, size) < 0) |
487 | return false; | 487 | return false; |
488 | 488 | ||
489 | return true; | 489 | return true; |
490 | } | 490 | } |
491 | 491 | ||
@@ -495,12 +495,12 @@ static int get_format_str(struct display_format *fmt) | |||
495 | int ret; | 495 | int ret; |
496 | char buf[128]; | 496 | char buf[128]; |
497 | int i; | 497 | int i; |
498 | 498 | ||
499 | memset(fmt, 0, sizeof(struct display_format)); | 499 | memset(fmt, 0, sizeof(struct display_format)); |
500 | 500 | ||
501 | if (get_token_str(fmt->name, sizeof fmt->name) < 0) | 501 | if (get_token_str(fmt->name, sizeof fmt->name) < 0) |
502 | return -10; | 502 | return -10; |
503 | 503 | ||
504 | /* Determine the group id */ | 504 | /* Determine the group id */ |
505 | fmt->group_id = 0; | 505 | fmt->group_id = 0; |
506 | for (i = 0; i < format_count; i++) | 506 | for (i = 0; i < format_count; i++) |
@@ -510,30 +510,30 @@ static int get_format_str(struct display_format *fmt) | |||
510 | fmt->group_id = formats[i]->group_id; | 510 | fmt->group_id = formats[i]->group_id; |
511 | break; | 511 | break; |
512 | } | 512 | } |
513 | 513 | ||
514 | if (formats[i]->group_id > fmt->group_id) | 514 | if (formats[i]->group_id > fmt->group_id) |
515 | fmt->group_id = formats[i]->group_id; | 515 | fmt->group_id = formats[i]->group_id; |
516 | } | 516 | } |
517 | 517 | ||
518 | if (i == format_count) | 518 | if (i == format_count) |
519 | fmt->group_id++; | 519 | fmt->group_id++; |
520 | 520 | ||
521 | logf("format: (%d) %s", fmt->group_id, fmt->name); | 521 | logf("format: (%d) %s", fmt->group_id, fmt->name); |
522 | 522 | ||
523 | if (get_token_str(buf, sizeof buf) < 0) | 523 | if (get_token_str(buf, sizeof buf) < 0) |
524 | return -10; | 524 | return -10; |
525 | 525 | ||
526 | fmt->formatstr = tagtree_strdup(buf); | 526 | fmt->formatstr = tagtree_strdup(buf); |
527 | 527 | ||
528 | while (fmt->tag_count < MAX_TAGS) | 528 | while (fmt->tag_count < MAX_TAGS) |
529 | { | 529 | { |
530 | ret = get_tag(&fmt->tags[fmt->tag_count]); | 530 | ret = get_tag(&fmt->tags[fmt->tag_count]); |
531 | if (ret < 0) | 531 | if (ret < 0) |
532 | return -11; | 532 | return -11; |
533 | 533 | ||
534 | if (ret == 0) | 534 | if (ret == 0) |
535 | break; | 535 | break; |
536 | 536 | ||
537 | switch (fmt->tags[fmt->tag_count]) { | 537 | switch (fmt->tags[fmt->tag_count]) { |
538 | case var_sorttype: | 538 | case var_sorttype: |
539 | if (!read_variable(buf, sizeof buf)) | 539 | if (!read_variable(buf, sizeof buf)) |
@@ -541,24 +541,24 @@ static int get_format_str(struct display_format *fmt) | |||
541 | if (!strcasecmp("inverse", buf)) | 541 | if (!strcasecmp("inverse", buf)) |
542 | fmt->sort_inverse = true; | 542 | fmt->sort_inverse = true; |
543 | break; | 543 | break; |
544 | 544 | ||
545 | case var_limit: | 545 | case var_limit: |
546 | if (!read_variable(buf, sizeof buf)) | 546 | if (!read_variable(buf, sizeof buf)) |
547 | return -13; | 547 | return -13; |
548 | fmt->limit = atoi(buf); | 548 | fmt->limit = atoi(buf); |
549 | break; | 549 | break; |
550 | 550 | ||
551 | case var_strip: | 551 | case var_strip: |
552 | if (!read_variable(buf, sizeof buf)) | 552 | if (!read_variable(buf, sizeof buf)) |
553 | return -14; | 553 | return -14; |
554 | fmt->strip = atoi(buf); | 554 | fmt->strip = atoi(buf); |
555 | break; | 555 | break; |
556 | 556 | ||
557 | default: | 557 | default: |
558 | fmt->tag_count++; | 558 | fmt->tag_count++; |
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | return 1; | 562 | return 1; |
563 | } | 563 | } |
564 | 564 | ||
@@ -571,17 +571,17 @@ static int add_format(const char *buf) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | strp = buf; | 573 | strp = buf; |
574 | 574 | ||
575 | if (formats[format_count] == NULL) | 575 | if (formats[format_count] == NULL) |
576 | formats[format_count] = tagtree_alloc0(sizeof(struct display_format)); | 576 | formats[format_count] = tagtree_alloc0(sizeof(struct display_format)); |
577 | 577 | ||
578 | if (get_format_str(formats[format_count]) < 0) | 578 | if (get_format_str(formats[format_count]) < 0) |
579 | { | 579 | { |
580 | logf("get_format_str() parser failed!"); | 580 | logf("get_format_str() parser failed!"); |
581 | memset(formats[format_count], 0, sizeof(struct display_format)); | 581 | memset(formats[format_count], 0, sizeof(struct display_format)); |
582 | return -4; | 582 | return -4; |
583 | } | 583 | } |
584 | 584 | ||
585 | while (*strp != '\0' && *strp != '?') | 585 | while (*strp != '\0' && *strp != '?') |
586 | strp++; | 586 | strp++; |
587 | 587 | ||
@@ -594,28 +594,28 @@ static int add_format(const char *buf) | |||
594 | while (1) | 594 | while (1) |
595 | { | 595 | { |
596 | struct tagcache_search_clause *newclause; | 596 | struct tagcache_search_clause *newclause; |
597 | 597 | ||
598 | if (clause_count >= TAGCACHE_MAX_CLAUSES) | 598 | if (clause_count >= TAGCACHE_MAX_CLAUSES) |
599 | { | 599 | { |
600 | logf("too many clauses"); | 600 | logf("too many clauses"); |
601 | break; | 601 | break; |
602 | } | 602 | } |
603 | 603 | ||
604 | newclause = tagtree_alloc(sizeof(struct tagcache_search_clause)); | 604 | newclause = tagtree_alloc(sizeof(struct tagcache_search_clause)); |
605 | 605 | ||
606 | formats[format_count]->clause[clause_count] = newclause; | 606 | formats[format_count]->clause[clause_count] = newclause; |
607 | if (!read_clause(newclause)) | 607 | if (!read_clause(newclause)) |
608 | break; | 608 | break; |
609 | 609 | ||
610 | clause_count++; | 610 | clause_count++; |
611 | } | 611 | } |
612 | tagtree_unlock(); | 612 | tagtree_unlock(); |
613 | 613 | ||
614 | formats[format_count]->clause_count = clause_count; | 614 | formats[format_count]->clause_count = clause_count; |
615 | } | 615 | } |
616 | 616 | ||
617 | format_count++; | 617 | format_count++; |
618 | 618 | ||
619 | return 1; | 619 | return 1; |
620 | } | 620 | } |
621 | 621 | ||
@@ -624,28 +624,28 @@ static int get_condition(struct search_instruction *inst) | |||
624 | struct tagcache_search_clause *new_clause; | 624 | struct tagcache_search_clause *new_clause; |
625 | int clause_count; | 625 | int clause_count; |
626 | char buf[128]; | 626 | char buf[128]; |
627 | 627 | ||
628 | switch (*strp) | 628 | switch (*strp) |
629 | { | 629 | { |
630 | case '=': | 630 | case '=': |
631 | { | 631 | { |
632 | int i; | 632 | int i; |
633 | 633 | ||
634 | if (get_token_str(buf, sizeof buf) < 0) | 634 | if (get_token_str(buf, sizeof buf) < 0) |
635 | return -1; | 635 | return -1; |
636 | 636 | ||
637 | for (i = 0; i < format_count; i++) | 637 | for (i = 0; i < format_count; i++) |
638 | { | 638 | { |
639 | if (!strcasecmp(formats[i]->name, buf)) | 639 | if (!strcasecmp(formats[i]->name, buf)) |
640 | break; | 640 | break; |
641 | } | 641 | } |
642 | 642 | ||
643 | if (i == format_count) | 643 | if (i == format_count) |
644 | { | 644 | { |
645 | logf("format not found: %s", buf); | 645 | logf("format not found: %s", buf); |
646 | return -2; | 646 | return -2; |
647 | } | 647 | } |
648 | 648 | ||
649 | inst->format_id[inst->tagorder_count] = formats[i]->group_id; | 649 | inst->format_id[inst->tagorder_count] = formats[i]->group_id; |
650 | return 1; | 650 | return 1; |
651 | } | 651 | } |
@@ -665,10 +665,10 @@ static int get_condition(struct search_instruction *inst) | |||
665 | logf("Too many clauses"); | 665 | logf("Too many clauses"); |
666 | return false; | 666 | return false; |
667 | } | 667 | } |
668 | 668 | ||
669 | new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause)); | 669 | new_clause = tagtree_alloc(sizeof(struct tagcache_search_clause)); |
670 | inst->clause[inst->tagorder_count][clause_count] = new_clause; | 670 | inst->clause[inst->tagorder_count][clause_count] = new_clause; |
671 | 671 | ||
672 | if (*strp == '|') | 672 | if (*strp == '|') |
673 | { | 673 | { |
674 | strp++; | 674 | strp++; |
@@ -683,7 +683,7 @@ static int get_condition(struct search_instruction *inst) | |||
683 | return -1; | 683 | return -1; |
684 | } | 684 | } |
685 | inst->clause_count[inst->tagorder_count]++; | 685 | inst->clause_count[inst->tagorder_count]++; |
686 | 686 | ||
687 | return 1; | 687 | return 1; |
688 | } | 688 | } |
689 | 689 | ||
@@ -702,25 +702,25 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
702 | struct search_instruction *inst = &entry->si; | 702 | struct search_instruction *inst = &entry->si; |
703 | char buf[MAX_PATH]; | 703 | char buf[MAX_PATH]; |
704 | int i; | 704 | int i; |
705 | 705 | ||
706 | strp = str; | 706 | strp = str; |
707 | 707 | ||
708 | /* Parse entry name */ | 708 | /* Parse entry name */ |
709 | if (get_token_str(entry->name, sizeof entry->name) < 0) | 709 | if (get_token_str(entry->name, sizeof entry->name) < 0) |
710 | { | 710 | { |
711 | logf("No name found."); | 711 | logf("No name found."); |
712 | return false; | 712 | return false; |
713 | } | 713 | } |
714 | 714 | ||
715 | /* Parse entry type */ | 715 | /* Parse entry type */ |
716 | if (get_tag(&entry->type) <= 0) | 716 | if (get_tag(&entry->type) <= 0) |
717 | return false; | 717 | return false; |
718 | 718 | ||
719 | if (entry->type == menu_load) | 719 | if (entry->type == menu_load) |
720 | { | 720 | { |
721 | if (get_token_str(buf, sizeof buf) < 0) | 721 | if (get_token_str(buf, sizeof buf) < 0) |
722 | return false; | 722 | return false; |
723 | 723 | ||
724 | /* Find the matching root menu or "create" it */ | 724 | /* Find the matching root menu or "create" it */ |
725 | for (i = 0; i < menu_count; i++) | 725 | for (i = 0; i < menu_count; i++) |
726 | { | 726 | { |
@@ -730,38 +730,38 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
730 | return true; | 730 | return true; |
731 | } | 731 | } |
732 | } | 732 | } |
733 | 733 | ||
734 | if (menu_count >= TAGMENU_MAX_MENUS) | 734 | if (menu_count >= TAGMENU_MAX_MENUS) |
735 | { | 735 | { |
736 | logf("max menucount reached"); | 736 | logf("max menucount reached"); |
737 | return false; | 737 | return false; |
738 | } | 738 | } |
739 | 739 | ||
740 | /* Allocate a new menu unless link is found. */ | 740 | /* Allocate a new menu unless link is found. */ |
741 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); | 741 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); |
742 | strlcpy(menus[menu_count]->id, buf, MAX_MENU_ID_SIZE); | 742 | strlcpy(menus[menu_count]->id, buf, MAX_MENU_ID_SIZE); |
743 | entry->link = menu_count; | 743 | entry->link = menu_count; |
744 | ++menu_count; | 744 | ++menu_count; |
745 | 745 | ||
746 | return true; | 746 | return true; |
747 | } | 747 | } |
748 | 748 | ||
749 | if (entry->type != menu_next) | 749 | if (entry->type != menu_next) |
750 | return false; | 750 | return false; |
751 | 751 | ||
752 | while (inst->tagorder_count < MAX_TAGS) | 752 | while (inst->tagorder_count < MAX_TAGS) |
753 | { | 753 | { |
754 | ret = get_tag(&inst->tagorder[inst->tagorder_count]); | 754 | ret = get_tag(&inst->tagorder[inst->tagorder_count]); |
755 | if (ret < 0) | 755 | if (ret < 0) |
756 | { | 756 | { |
757 | logf("Parse error #1"); | 757 | logf("Parse error #1"); |
758 | logf("%s", strp); | 758 | logf("%s", strp); |
759 | return false; | 759 | return false; |
760 | } | 760 | } |
761 | 761 | ||
762 | if (ret == 0) | 762 | if (ret == 0) |
763 | break ; | 763 | break ; |
764 | 764 | ||
765 | logf("tag: %d", inst->tagorder[inst->tagorder_count]); | 765 | logf("tag: %d", inst->tagorder[inst->tagorder_count]); |
766 | 766 | ||
767 | tagtree_lock(); | 767 | tagtree_lock(); |
@@ -772,11 +772,11 @@ static bool parse_search(struct menu_entry *entry, const char *str) | |||
772 | return false; | 772 | return false; |
773 | 773 | ||
774 | inst->tagorder_count++; | 774 | inst->tagorder_count++; |
775 | 775 | ||
776 | if (get_tag(&type) <= 0 || type != menu_next) | 776 | if (get_tag(&type) <= 0 || type != menu_next) |
777 | break; | 777 | break; |
778 | } | 778 | } |
779 | 779 | ||
780 | return true; | 780 | return true; |
781 | } | 781 | } |
782 | 782 | ||
@@ -787,7 +787,7 @@ static int compare(const void *p1, const void *p2) | |||
787 | 787 | ||
788 | if (sort_inverse) | 788 | if (sort_inverse) |
789 | return strncasecmp(e2->name, e1->name, MAX_PATH); | 789 | return strncasecmp(e2->name, e1->name, MAX_PATH); |
790 | 790 | ||
791 | return strncasecmp(e1->name, e2->name, MAX_PATH); | 791 | return strncasecmp(e1->name, e2->name, MAX_PATH); |
792 | } | 792 | } |
793 | 793 | ||
@@ -795,13 +795,13 @@ static void tagtree_buffer_event(void *data) | |||
795 | { | 795 | { |
796 | struct tagcache_search tcs; | 796 | struct tagcache_search tcs; |
797 | struct mp3entry *id3 = (struct mp3entry*)data; | 797 | struct mp3entry *id3 = (struct mp3entry*)data; |
798 | 798 | ||
799 | /* Do not gather data unless proper setting has been enabled. */ | 799 | /* Do not gather data unless proper setting has been enabled. */ |
800 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) | 800 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) |
801 | return; | 801 | return; |
802 | 802 | ||
803 | logf("be:%s", id3->path); | 803 | logf("be:%s", id3->path); |
804 | 804 | ||
805 | while (! tagcache_is_fully_initialized()) | 805 | while (! tagcache_is_fully_initialized()) |
806 | yield(); | 806 | yield(); |
807 | 807 | ||
@@ -810,7 +810,7 @@ static void tagtree_buffer_event(void *data) | |||
810 | logf("tc stat: not found: %s", id3->path); | 810 | logf("tc stat: not found: %s", id3->path); |
811 | return; | 811 | return; |
812 | } | 812 | } |
813 | 813 | ||
814 | if (global_settings.runtimedb) | 814 | if (global_settings.runtimedb) |
815 | { | 815 | { |
816 | id3->playcount = tagcache_get_numeric(&tcs, tag_playcount); | 816 | id3->playcount = tagcache_get_numeric(&tcs, tag_playcount); |
@@ -819,11 +819,11 @@ static void tagtree_buffer_event(void *data) | |||
819 | id3->lastplayed = tagcache_get_numeric(&tcs, tag_lastplayed); | 819 | id3->lastplayed = tagcache_get_numeric(&tcs, tag_lastplayed); |
820 | id3->score = tagcache_get_numeric(&tcs, tag_virt_autoscore) / 10; | 820 | id3->score = tagcache_get_numeric(&tcs, tag_virt_autoscore) / 10; |
821 | id3->playtime = tagcache_get_numeric(&tcs, tag_playtime); | 821 | id3->playtime = tagcache_get_numeric(&tcs, tag_playtime); |
822 | 822 | ||
823 | logf("-> %ld/%ld", id3->playcount, id3->playtime); | 823 | logf("-> %ld/%ld", id3->playcount, id3->playtime); |
824 | } | 824 | } |
825 | 825 | ||
826 | #if CONFIG_CODEC == SWCODEC | 826 | #if CONFIG_CODEC == SWCODEC |
827 | if (global_settings.autoresume_enable) | 827 | if (global_settings.autoresume_enable) |
828 | { | 828 | { |
829 | /* Load current file resume offset if not already defined (by | 829 | /* Load current file resume offset if not already defined (by |
@@ -832,15 +832,15 @@ static void tagtree_buffer_event(void *data) | |||
832 | { | 832 | { |
833 | id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset); | 833 | id3->offset = tagcache_get_numeric(&tcs, tag_lastoffset); |
834 | 834 | ||
835 | logf("tagtree_buffer_event: Set offset for %s to %lX\n", | 835 | logf("tagtree_buffer_event: Set offset for %s to %lX\n", |
836 | str_or_empty(id3->title), id3->offset); | 836 | str_or_empty(id3->title), id3->offset); |
837 | } | 837 | } |
838 | } | 838 | } |
839 | #endif | 839 | #endif |
840 | 840 | ||
841 | /* Store our tagcache index pointer. */ | 841 | /* Store our tagcache index pointer. */ |
842 | id3->tagcache_idx = tcs.idx_id+1; | 842 | id3->tagcache_idx = tcs.idx_id+1; |
843 | 843 | ||
844 | tagcache_search_finish(&tcs); | 844 | tagcache_search_finish(&tcs); |
845 | } | 845 | } |
846 | 846 | ||
@@ -849,14 +849,14 @@ static void tagtree_track_finish_event(void *data) | |||
849 | long lastplayed; | 849 | long lastplayed; |
850 | long tagcache_idx; | 850 | long tagcache_idx; |
851 | struct mp3entry *id3 = (struct mp3entry*)data; | 851 | struct mp3entry *id3 = (struct mp3entry*)data; |
852 | 852 | ||
853 | /* Do not gather data unless proper setting has been enabled. */ | 853 | /* Do not gather data unless proper setting has been enabled. */ |
854 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) | 854 | if (!global_settings.runtimedb && !global_settings.autoresume_enable) |
855 | { | 855 | { |
856 | logf("runtimedb gathering and autoresume not enabled"); | 856 | logf("runtimedb gathering and autoresume not enabled"); |
857 | return; | 857 | return; |
858 | } | 858 | } |
859 | 859 | ||
860 | tagcache_idx=id3->tagcache_idx; | 860 | tagcache_idx=id3->tagcache_idx; |
861 | if (!tagcache_idx) | 861 | if (!tagcache_idx) |
862 | { | 862 | { |
@@ -864,7 +864,7 @@ static void tagtree_track_finish_event(void *data) | |||
864 | return; | 864 | return; |
865 | } | 865 | } |
866 | tagcache_idx--; | 866 | tagcache_idx--; |
867 | 867 | ||
868 | /* Don't process unplayed tracks, or tracks interrupted within the | 868 | /* Don't process unplayed tracks, or tracks interrupted within the |
869 | first 15 seconds. */ | 869 | first 15 seconds. */ |
870 | if (id3->elapsed == 0 | 870 | if (id3->elapsed == 0 |
@@ -876,24 +876,24 @@ static void tagtree_track_finish_event(void *data) | |||
876 | logf("not logging unplayed or skipped track"); | 876 | logf("not logging unplayed or skipped track"); |
877 | return; | 877 | return; |
878 | } | 878 | } |
879 | 879 | ||
880 | lastplayed = tagcache_increase_serial(); | 880 | lastplayed = tagcache_increase_serial(); |
881 | if (lastplayed < 0) | 881 | if (lastplayed < 0) |
882 | { | 882 | { |
883 | logf("incorrect tc serial:%ld", lastplayed); | 883 | logf("incorrect tc serial:%ld", lastplayed); |
884 | return; | 884 | return; |
885 | } | 885 | } |
886 | 886 | ||
887 | if (global_settings.runtimedb) | 887 | if (global_settings.runtimedb) |
888 | { | 888 | { |
889 | long playcount; | 889 | long playcount; |
890 | long playtime; | 890 | long playtime; |
891 | 891 | ||
892 | playcount = id3->playcount + 1; | 892 | playcount = id3->playcount + 1; |
893 | 893 | ||
894 | /* Ignore the last 15s (crossfade etc.) */ | 894 | /* Ignore the last 15s (crossfade etc.) */ |
895 | playtime = id3->playtime + MIN(id3->length, id3->elapsed + 15 * 1000); | 895 | playtime = id3->playtime + MIN(id3->length, id3->elapsed + 15 * 1000); |
896 | 896 | ||
897 | logf("ube:%s", id3->path); | 897 | logf("ube:%s", id3->path); |
898 | logf("-> %ld/%ld", playcount, playtime); | 898 | logf("-> %ld/%ld", playcount, playtime); |
899 | logf("-> %ld/%ld/%ld", id3->elapsed, id3->length, | 899 | logf("-> %ld/%ld/%ld", id3->elapsed, id3->length, |
@@ -905,7 +905,7 @@ static void tagtree_track_finish_event(void *data) | |||
905 | tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed); | 905 | tagcache_update_numeric(tagcache_idx, tag_lastplayed, lastplayed); |
906 | } | 906 | } |
907 | 907 | ||
908 | #if CONFIG_CODEC == SWCODEC | 908 | #if CONFIG_CODEC == SWCODEC |
909 | if (global_settings.autoresume_enable) | 909 | if (global_settings.autoresume_enable) |
910 | { | 910 | { |
911 | unsigned long offset | 911 | unsigned long offset |
@@ -913,7 +913,7 @@ static void tagtree_track_finish_event(void *data) | |||
913 | 913 | ||
914 | tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset); | 914 | tagcache_update_numeric(tagcache_idx, tag_lastoffset, offset); |
915 | 915 | ||
916 | logf("tagtree_track_finish_event: Save offset for %s: %lX", | 916 | logf("tagtree_track_finish_event: Save offset for %s: %lX", |
917 | str_or_empty(id3->title), offset); | 917 | str_or_empty(id3->title), offset); |
918 | } | 918 | } |
919 | #endif | 919 | #endif |
@@ -922,13 +922,13 @@ static void tagtree_track_finish_event(void *data) | |||
922 | bool tagtree_export(void) | 922 | bool tagtree_export(void) |
923 | { | 923 | { |
924 | struct tagcache_search tcs; | 924 | struct tagcache_search tcs; |
925 | 925 | ||
926 | splash(0, str(LANG_CREATING)); | 926 | splash(0, str(LANG_CREATING)); |
927 | if (!tagcache_create_changelog(&tcs)) | 927 | if (!tagcache_create_changelog(&tcs)) |
928 | { | 928 | { |
929 | splash(HZ*2, ID2P(LANG_FAILED)); | 929 | splash(HZ*2, ID2P(LANG_FAILED)); |
930 | } | 930 | } |
931 | 931 | ||
932 | return false; | 932 | return false; |
933 | } | 933 | } |
934 | 934 | ||
@@ -939,7 +939,7 @@ bool tagtree_import(void) | |||
939 | { | 939 | { |
940 | splash(HZ*2, ID2P(LANG_FAILED)); | 940 | splash(HZ*2, ID2P(LANG_FAILED)); |
941 | } | 941 | } |
942 | 942 | ||
943 | return false; | 943 | return false; |
944 | } | 944 | } |
945 | 945 | ||
@@ -952,16 +952,16 @@ static int parse_line(int n, char *buf, void *parameters) | |||
952 | static bool read_menu; | 952 | static bool read_menu; |
953 | int i; | 953 | int i; |
954 | char *p; | 954 | char *p; |
955 | 955 | ||
956 | (void)parameters; | 956 | (void)parameters; |
957 | 957 | ||
958 | /* Strip possible <CR> at end of line. */ | 958 | /* Strip possible <CR> at end of line. */ |
959 | p = strchr(buf, '\r'); | 959 | p = strchr(buf, '\r'); |
960 | if (p != NULL) | 960 | if (p != NULL) |
961 | *p = '\0'; | 961 | *p = '\0'; |
962 | 962 | ||
963 | logf("parse:%d/%s", n, buf); | 963 | logf("parse:%d/%s", n, buf); |
964 | 964 | ||
965 | /* First line, do initialisation. */ | 965 | /* First line, do initialisation. */ |
966 | if (n == 0) | 966 | if (n == 0) |
967 | { | 967 | { |
@@ -970,13 +970,13 @@ static int parse_line(int n, char *buf, void *parameters) | |||
970 | logf("Version mismatch"); | 970 | logf("Version mismatch"); |
971 | return -1; | 971 | return -1; |
972 | } | 972 | } |
973 | 973 | ||
974 | read_menu = false; | 974 | read_menu = false; |
975 | } | 975 | } |
976 | 976 | ||
977 | if (buf[0] == '#') | 977 | if (buf[0] == '#') |
978 | return 0; | 978 | return 0; |
979 | 979 | ||
980 | if (buf[0] == '\0') | 980 | if (buf[0] == '\0') |
981 | { | 981 | { |
982 | if (read_menu) | 982 | if (read_menu) |
@@ -986,13 +986,13 @@ static int parse_line(int n, char *buf, void *parameters) | |||
986 | } | 986 | } |
987 | return 0; | 987 | return 0; |
988 | } | 988 | } |
989 | 989 | ||
990 | if (!read_menu) | 990 | if (!read_menu) |
991 | { | 991 | { |
992 | strp = buf; | 992 | strp = buf; |
993 | if (get_tag(&variable) <= 0) | 993 | if (get_tag(&variable) <= 0) |
994 | return 0; | 994 | return 0; |
995 | 995 | ||
996 | switch (variable) | 996 | switch (variable) |
997 | { | 997 | { |
998 | case var_format: | 998 | case var_format: |
@@ -1001,33 +1001,33 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1001 | logf("Format add fail: %s", data); | 1001 | logf("Format add fail: %s", data); |
1002 | } | 1002 | } |
1003 | break; | 1003 | break; |
1004 | 1004 | ||
1005 | case var_include: | 1005 | case var_include: |
1006 | if (get_token_str(data, sizeof(data)) < 0) | 1006 | if (get_token_str(data, sizeof(data)) < 0) |
1007 | { | 1007 | { |
1008 | logf("%%include empty"); | 1008 | logf("%%include empty"); |
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | if (!parse_menu(data)) | 1012 | if (!parse_menu(data)) |
1013 | { | 1013 | { |
1014 | logf("Load menu fail: %s", data); | 1014 | logf("Load menu fail: %s", data); |
1015 | } | 1015 | } |
1016 | break; | 1016 | break; |
1017 | 1017 | ||
1018 | case var_menu_start: | 1018 | case var_menu_start: |
1019 | if (menu_count >= TAGMENU_MAX_MENUS) | 1019 | if (menu_count >= TAGMENU_MAX_MENUS) |
1020 | { | 1020 | { |
1021 | logf("max menucount reached"); | 1021 | logf("max menucount reached"); |
1022 | return 0; | 1022 | return 0; |
1023 | } | 1023 | } |
1024 | 1024 | ||
1025 | if (get_token_str(data, sizeof data) < 0) | 1025 | if (get_token_str(data, sizeof data) < 0) |
1026 | { | 1026 | { |
1027 | logf("%%menu_start id empty"); | 1027 | logf("%%menu_start id empty"); |
1028 | return 0; | 1028 | return 0; |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | menu = NULL; | 1031 | menu = NULL; |
1032 | for (i = 0; i < menu_count; i++) | 1032 | for (i = 0; i < menu_count; i++) |
1033 | { | 1033 | { |
@@ -1036,15 +1036,15 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1036 | menu = menus[i]; | 1036 | menu = menus[i]; |
1037 | } | 1037 | } |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | if (menu == NULL) | 1040 | if (menu == NULL) |
1041 | { | 1041 | { |
1042 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); | 1042 | menus[menu_count] = tagtree_alloc0(sizeof(struct menu_root)); |
1043 | menu = menus[menu_count]; | 1043 | menu = menus[menu_count]; |
1044 | ++menu_count; | 1044 | ++menu_count; |
1045 | strlcpy(menu->id, data, MAX_MENU_ID_SIZE); | 1045 | strlcpy(menu->id, data, MAX_MENU_ID_SIZE); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) | 1048 | if (get_token_str(menu->title, sizeof(menu->title)) < 0) |
1049 | { | 1049 | { |
1050 | logf("%%menu_start title empty"); | 1050 | logf("%%menu_start title empty"); |
@@ -1053,18 +1053,18 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1053 | logf("menu: %s", menu->title); | 1053 | logf("menu: %s", menu->title); |
1054 | read_menu = true; | 1054 | read_menu = true; |
1055 | break; | 1055 | break; |
1056 | 1056 | ||
1057 | case var_rootmenu: | 1057 | case var_rootmenu: |
1058 | /* Only set root menu once. */ | 1058 | /* Only set root menu once. */ |
1059 | if (rootmenu >= 0) | 1059 | if (rootmenu >= 0) |
1060 | break; | 1060 | break; |
1061 | 1061 | ||
1062 | if (get_token_str(data, sizeof(data)) < 0) | 1062 | if (get_token_str(data, sizeof(data)) < 0) |
1063 | { | 1063 | { |
1064 | logf("%%rootmenu empty"); | 1064 | logf("%%rootmenu empty"); |
1065 | return 0; | 1065 | return 0; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | for (i = 0; i < menu_count; i++) | 1068 | for (i = 0; i < menu_count; i++) |
1069 | { | 1069 | { |
1070 | if (!strcasecmp(menus[i]->id, data)) | 1070 | if (!strcasecmp(menus[i]->id, data)) |
@@ -1074,16 +1074,16 @@ static int parse_line(int n, char *buf, void *parameters) | |||
1074 | } | 1074 | } |
1075 | break; | 1075 | break; |
1076 | } | 1076 | } |
1077 | 1077 | ||
1078 | return 0; | 1078 | return 0; |
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | if (menu->itemcount >= TAGMENU_MAX_ITEMS) | 1081 | if (menu->itemcount >= TAGMENU_MAX_ITEMS) |
1082 | { | 1082 | { |
1083 | logf("max itemcount reached"); | 1083 | logf("max itemcount reached"); |
1084 | return 0; | 1084 | return 0; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | /* Allocate */ | 1087 | /* Allocate */ |
1088 | if (menu->items[menu->itemcount] == NULL) | 1088 | if (menu->items[menu->itemcount] == NULL) |
1089 | menu->items[menu->itemcount] = tagtree_alloc0(sizeof(struct menu_entry)); | 1089 | menu->items[menu->itemcount] = tagtree_alloc0(sizeof(struct menu_entry)); |
@@ -1106,18 +1106,18 @@ static bool parse_menu(const char *filename) | |||
1106 | logf("max menucount reached"); | 1106 | logf("max menucount reached"); |
1107 | return false; | 1107 | return false; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | fd = open(filename, O_RDONLY); | 1110 | fd = open(filename, O_RDONLY); |
1111 | if (fd < 0) | 1111 | if (fd < 0) |
1112 | { | 1112 | { |
1113 | logf("Search instruction file not found."); | 1113 | logf("Search instruction file not found."); |
1114 | return false; | 1114 | return false; |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | /* Now read file for real, parsing into si */ | 1117 | /* Now read file for real, parsing into si */ |
1118 | fast_readline(fd, buf, sizeof buf, NULL, parse_line); | 1118 | fast_readline(fd, buf, sizeof buf, NULL, parse_line); |
1119 | close(fd); | 1119 | close(fd); |
1120 | 1120 | ||
1121 | return true; | 1121 | return true; |
1122 | } | 1122 | } |
1123 | 1123 | ||
@@ -1136,7 +1136,7 @@ void tagtree_init(void) | |||
1136 | sizeof(struct tagentry), sizeof(struct entry)); | 1136 | sizeof(struct tagentry), sizeof(struct entry)); |
1137 | if (lock_count > 0) | 1137 | if (lock_count > 0) |
1138 | panicf("tagtree locked after parsing"); | 1138 | panicf("tagtree locked after parsing"); |
1139 | 1139 | ||
1140 | /* If no root menu is set, assume it's the first single menu | 1140 | /* If no root menu is set, assume it's the first single menu |
1141 | * we have. That shouldn't normally happen. */ | 1141 | * we have. That shouldn't normally happen. */ |
1142 | if (rootmenu < 0) | 1142 | if (rootmenu < 0) |
@@ -1151,14 +1151,14 @@ void tagtree_init(void) | |||
1151 | static bool show_search_progress(bool init, int count) | 1151 | static bool show_search_progress(bool init, int count) |
1152 | { | 1152 | { |
1153 | static int last_tick = 0; | 1153 | static int last_tick = 0; |
1154 | 1154 | ||
1155 | /* Don't show splashes for 1/2 second after starting search */ | 1155 | /* Don't show splashes for 1/2 second after starting search */ |
1156 | if (init) | 1156 | if (init) |
1157 | { | 1157 | { |
1158 | last_tick = current_tick + HZ/2; | 1158 | last_tick = current_tick + HZ/2; |
1159 | return true; | 1159 | return true; |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | /* Update progress every 1/10 of a second */ | 1162 | /* Update progress every 1/10 of a second */ |
1163 | if (TIME_AFTER(current_tick, last_tick + HZ/10)) | 1163 | if (TIME_AFTER(current_tick, last_tick + HZ/10)) |
1164 | { | 1164 | { |
@@ -1168,7 +1168,7 @@ static bool show_search_progress(bool init, int count) | |||
1168 | last_tick = current_tick; | 1168 | last_tick = current_tick; |
1169 | yield(); | 1169 | yield(); |
1170 | } | 1170 | } |
1171 | 1171 | ||
1172 | return true; | 1172 | return true; |
1173 | } | 1173 | } |
1174 | 1174 | ||
@@ -1181,7 +1181,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1181 | int parpos = 0; | 1181 | int parpos = 0; |
1182 | int buf_pos = 0; | 1182 | int buf_pos = 0; |
1183 | int i; | 1183 | int i; |
1184 | 1184 | ||
1185 | memset(buf, 0, buf_size); | 1185 | memset(buf, 0, buf_size); |
1186 | for (i = 0; fmt->formatstr[i] != '\0'; i++) | 1186 | for (i = 0; fmt->formatstr[i] != '\0'; i++) |
1187 | { | 1187 | { |
@@ -1195,7 +1195,7 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1195 | return -1; | 1195 | return -1; |
1196 | } | 1196 | } |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | char formatchar = fmt->formatstr[i]; | 1199 | char formatchar = fmt->formatstr[i]; |
1200 | 1200 | ||
1201 | if (read_format) | 1201 | if (read_format) |
@@ -1260,16 +1260,16 @@ static int format_str(struct tagcache_search *tcs, struct display_format *fmt, | |||
1260 | } | 1260 | } |
1261 | else | 1261 | else |
1262 | buf[buf_pos++] = formatchar; | 1262 | buf[buf_pos++] = formatchar; |
1263 | 1263 | ||
1264 | if (buf_pos >= buf_size - 1) /* need at least one more byte for \0 */ | 1264 | if (buf_pos >= buf_size - 1) /* need at least one more byte for \0 */ |
1265 | { | 1265 | { |
1266 | logf("buffer overflow"); | 1266 | logf("buffer overflow"); |
1267 | return -4; | 1267 | return -4; |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | 1270 | ||
1271 | buf[buf_pos++] = '\0'; | 1271 | buf[buf_pos++] = '\0'; |
1272 | 1272 | ||
1273 | return 0; | 1273 | return 0; |
1274 | } | 1274 | } |
1275 | 1275 | ||
@@ -1312,19 +1312,19 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1312 | 1312 | ||
1313 | if (!tagcache_search(&tcs, tag)) | 1313 | if (!tagcache_search(&tcs, tag)) |
1314 | return -1; | 1314 | return -1; |
1315 | 1315 | ||
1316 | /* Prevent duplicate entries in the search list. */ | 1316 | /* Prevent duplicate entries in the search list. */ |
1317 | tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); | 1317 | tagcache_search_set_uniqbuf(&tcs, uniqbuf, UNIQBUF_SIZE); |
1318 | 1318 | ||
1319 | if (level || csi->clause_count[0] || TAGCACHE_IS_NUMERIC(tag)) | 1319 | if (level || csi->clause_count[0] || TAGCACHE_IS_NUMERIC(tag)) |
1320 | sort = true; | 1320 | sort = true; |
1321 | 1321 | ||
1322 | for (i = 0; i < level; i++) | 1322 | for (i = 0; i < level; i++) |
1323 | { | 1323 | { |
1324 | if (TAGCACHE_IS_NUMERIC(csi->tagorder[i])) | 1324 | if (TAGCACHE_IS_NUMERIC(csi->tagorder[i])) |
1325 | { | 1325 | { |
1326 | static struct tagcache_search_clause cc; | 1326 | static struct tagcache_search_clause cc; |
1327 | 1327 | ||
1328 | memset(&cc, 0, sizeof(struct tagcache_search_clause)); | 1328 | memset(&cc, 0, sizeof(struct tagcache_search_clause)); |
1329 | cc.tag = csi->tagorder[i]; | 1329 | cc.tag = csi->tagorder[i]; |
1330 | cc.type = clause_is; | 1330 | cc.type = clause_is; |
@@ -1334,7 +1334,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1334 | } | 1334 | } |
1335 | else | 1335 | else |
1336 | { | 1336 | { |
1337 | tagcache_search_add_filter(&tcs, csi->tagorder[i], | 1337 | tagcache_search_add_filter(&tcs, csi->tagorder[i], |
1338 | csi->result_seek[i]); | 1338 | csi->result_seek[i]); |
1339 | } | 1339 | } |
1340 | } | 1340 | } |
@@ -1345,15 +1345,15 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1345 | for (i = 0; i <= level; i++) | 1345 | for (i = 0; i <= level; i++) |
1346 | { | 1346 | { |
1347 | int j; | 1347 | int j; |
1348 | 1348 | ||
1349 | for (j = 0; j < csi->clause_count[i]; j++) | 1349 | for (j = 0; j < csi->clause_count[i]; j++) |
1350 | tagcache_search_add_clause(&tcs, csi->clause[i][j]); | 1350 | tagcache_search_add_clause(&tcs, csi->clause[i][j]); |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | current_offset = offset; | 1353 | current_offset = offset; |
1354 | current_entry_count = 0; | 1354 | current_entry_count = 0; |
1355 | c->dirfull = false; | 1355 | c->dirfull = false; |
1356 | 1356 | ||
1357 | fmt = NULL; | 1357 | fmt = NULL; |
1358 | for (i = 0; i < format_count; i++) | 1358 | for (i = 0; i < format_count; i++) |
1359 | { | 1359 | { |
@@ -1374,7 +1374,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1374 | sort_limit = 0; | 1374 | sort_limit = 0; |
1375 | strip = 0; | 1375 | strip = 0; |
1376 | } | 1376 | } |
1377 | 1377 | ||
1378 | /* lock buflib out due to possible yields */ | 1378 | /* lock buflib out due to possible yields */ |
1379 | tree_lock_cache(c); | 1379 | tree_lock_cache(c); |
1380 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); | 1380 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); |
@@ -1401,12 +1401,12 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1401 | 1401 | ||
1402 | total_count += 2; | 1402 | total_count += 2; |
1403 | } | 1403 | } |
1404 | 1404 | ||
1405 | while (tagcache_get_next(&tcs)) | 1405 | while (tagcache_get_next(&tcs)) |
1406 | { | 1406 | { |
1407 | if (total_count++ < offset) | 1407 | if (total_count++ < offset) |
1408 | continue; | 1408 | continue; |
1409 | 1409 | ||
1410 | dptr->newtable = NAVIBROWSE; | 1410 | dptr->newtable = NAVIBROWSE; |
1411 | if (tag == tag_title || tag == tag_filename) | 1411 | if (tag == tag_title || tag == tag_filename) |
1412 | { | 1412 | { |
@@ -1415,7 +1415,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1415 | } | 1415 | } |
1416 | else | 1416 | else |
1417 | dptr->extraseek = tcs.result_seek; | 1417 | dptr->extraseek = tcs.result_seek; |
1418 | 1418 | ||
1419 | fmt = NULL; | 1419 | fmt = NULL; |
1420 | /* Check the format */ | 1420 | /* Check the format */ |
1421 | tagtree_lock(); | 1421 | tagtree_lock(); |
@@ -1423,7 +1423,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1423 | { | 1423 | { |
1424 | if (formats[i]->group_id != csi->format_id[level]) | 1424 | if (formats[i]->group_id != csi->format_id[level]) |
1425 | continue; | 1425 | continue; |
1426 | 1426 | ||
1427 | if (tagcache_check_clauses(&tcs, formats[i]->clause, | 1427 | if (tagcache_check_clauses(&tcs, formats[i]->clause, |
1428 | formats[i]->clause_count)) | 1428 | formats[i]->clause_count)) |
1429 | { | 1429 | { |
@@ -1439,11 +1439,11 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1439 | tcs.result_len = strlen(tcs.result); | 1439 | tcs.result_len = strlen(tcs.result); |
1440 | tcs.ramresult = true; | 1440 | tcs.ramresult = true; |
1441 | } | 1441 | } |
1442 | 1442 | ||
1443 | if (!tcs.ramresult || fmt) | 1443 | if (!tcs.ramresult || fmt) |
1444 | { | 1444 | { |
1445 | dptr->name = core_get_data(c->cache.name_buffer_handle)+namebufused; | 1445 | dptr->name = core_get_data(c->cache.name_buffer_handle)+namebufused; |
1446 | 1446 | ||
1447 | if (fmt) | 1447 | if (fmt) |
1448 | { | 1448 | { |
1449 | int ret = format_str(&tcs, fmt, dptr->name, | 1449 | int ret = format_str(&tcs, fmt, dptr->name, |
@@ -1482,7 +1482,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1482 | } | 1482 | } |
1483 | else | 1483 | else |
1484 | dptr->name = tcs.result; | 1484 | dptr->name = tcs.result; |
1485 | 1485 | ||
1486 | dptr++; | 1486 | dptr++; |
1487 | current_entry_count++; | 1487 | current_entry_count++; |
1488 | 1488 | ||
@@ -1493,7 +1493,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1493 | sort = false; | 1493 | sort = false; |
1494 | break ; | 1494 | break ; |
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | if (init && !tcs.ramsearch) | 1497 | if (init && !tcs.ramsearch) |
1498 | { | 1498 | { |
1499 | if (!show_search_progress(false, total_count)) | 1499 | if (!show_search_progress(false, total_count)) |
@@ -1505,7 +1505,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1505 | } | 1505 | } |
1506 | } | 1506 | } |
1507 | } | 1507 | } |
1508 | 1508 | ||
1509 | if (sort) | 1509 | if (sort) |
1510 | { | 1510 | { |
1511 | struct tagentry *entries = get_entries(c); | 1511 | struct tagentry *entries = get_entries(c); |
@@ -1513,7 +1513,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1513 | current_entry_count - special_entry_count, | 1513 | current_entry_count - special_entry_count, |
1514 | sizeof(struct tagentry), compare); | 1514 | sizeof(struct tagentry), compare); |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | if (!init) | 1517 | if (!init) |
1518 | { | 1518 | { |
1519 | tagcache_search_finish(&tcs); | 1519 | tagcache_search_finish(&tcs); |
@@ -1521,7 +1521,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1521 | tagtree_unlock(); | 1521 | tagtree_unlock(); |
1522 | return current_entry_count; | 1522 | return current_entry_count; |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | while (tagcache_get_next(&tcs)) | 1525 | while (tagcache_get_next(&tcs)) |
1526 | { | 1526 | { |
1527 | if (!tcs.ramsearch) | 1527 | if (!tcs.ramsearch) |
@@ -1531,7 +1531,7 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1531 | } | 1531 | } |
1532 | total_count++; | 1532 | total_count++; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | tagcache_search_finish(&tcs); | 1535 | tagcache_search_finish(&tcs); |
1536 | tree_unlock_cache(c); | 1536 | tree_unlock_cache(c); |
1537 | tagtree_unlock(); | 1537 | tagtree_unlock(); |
@@ -1542,42 +1542,42 @@ static int retrieve_entries(struct tree_context *c, int offset, bool init) | |||
1542 | logf("Too small dir buffer"); | 1542 | logf("Too small dir buffer"); |
1543 | return 0; | 1543 | return 0; |
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | if (sort_limit) | 1546 | if (sort_limit) |
1547 | total_count = MIN(total_count, sort_limit); | 1547 | total_count = MIN(total_count, sort_limit); |
1548 | 1548 | ||
1549 | if (strip) | 1549 | if (strip) |
1550 | { | 1550 | { |
1551 | dptr = get_entries(c); | 1551 | dptr = get_entries(c); |
1552 | for (i = special_entry_count; i < current_entry_count; i++, dptr++) | 1552 | for (i = special_entry_count; i < current_entry_count; i++, dptr++) |
1553 | { | 1553 | { |
1554 | int len = strlen(dptr->name); | 1554 | int len = strlen(dptr->name); |
1555 | 1555 | ||
1556 | if (len < strip) | 1556 | if (len < strip) |
1557 | continue; | 1557 | continue; |
1558 | 1558 | ||
1559 | dptr->name = &dptr->name[strip]; | 1559 | dptr->name = &dptr->name[strip]; |
1560 | } | 1560 | } |
1561 | } | 1561 | } |
1562 | 1562 | ||
1563 | return total_count; | 1563 | return total_count; |
1564 | 1564 | ||
1565 | } | 1565 | } |
1566 | 1566 | ||
1567 | static int load_root(struct tree_context *c) | 1567 | static int load_root(struct tree_context *c) |
1568 | { | 1568 | { |
1569 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); | 1569 | struct tagentry *dptr = core_get_data(c->cache.entries_handle); |
1570 | int i; | 1570 | int i; |
1571 | 1571 | ||
1572 | tc = c; | 1572 | tc = c; |
1573 | c->currtable = ROOT; | 1573 | c->currtable = ROOT; |
1574 | if (c->dirlevel == 0) | 1574 | if (c->dirlevel == 0) |
1575 | c->currextra = rootmenu; | 1575 | c->currextra = rootmenu; |
1576 | 1576 | ||
1577 | menu = menus[c->currextra]; | 1577 | menu = menus[c->currextra]; |
1578 | if (menu == NULL) | 1578 | if (menu == NULL) |
1579 | return 0; | 1579 | return 0; |
1580 | 1580 | ||
1581 | for (i = 0; i < menu->itemcount; i++) | 1581 | for (i = 0; i < menu->itemcount; i++) |
1582 | { | 1582 | { |
1583 | dptr->name = menu->items[i]->name; | 1583 | dptr->name = menu->items[i]->name; |
@@ -1587,7 +1587,7 @@ static int load_root(struct tree_context *c) | |||
1587 | dptr->newtable = NAVIBROWSE; | 1587 | dptr->newtable = NAVIBROWSE; |
1588 | dptr->extraseek = i; | 1588 | dptr->extraseek = i; |
1589 | break; | 1589 | break; |
1590 | 1590 | ||
1591 | case menu_load: | 1591 | case menu_load: |
1592 | dptr->newtable = ROOT; | 1592 | dptr->newtable = ROOT; |
1593 | dptr->extraseek = menu->items[i]->link; | 1593 | dptr->extraseek = menu->items[i]->link; |
@@ -1596,10 +1596,10 @@ static int load_root(struct tree_context *c) | |||
1596 | 1596 | ||
1597 | dptr++; | 1597 | dptr++; |
1598 | } | 1598 | } |
1599 | 1599 | ||
1600 | current_offset = 0; | 1600 | current_offset = 0; |
1601 | current_entry_count = i; | 1601 | current_entry_count = i; |
1602 | 1602 | ||
1603 | return i; | 1603 | return i; |
1604 | } | 1604 | } |
1605 | 1605 | ||
@@ -1607,7 +1607,7 @@ int tagtree_load(struct tree_context* c) | |||
1607 | { | 1607 | { |
1608 | int count; | 1608 | int count; |
1609 | int table = c->currtable; | 1609 | int table = c->currtable; |
1610 | 1610 | ||
1611 | c->dirsindir = 0; | 1611 | c->dirsindir = 0; |
1612 | 1612 | ||
1613 | if (!table) | 1613 | if (!table) |
@@ -1618,7 +1618,7 @@ int tagtree_load(struct tree_context* c) | |||
1618 | c->currextra = rootmenu; | 1618 | c->currextra = rootmenu; |
1619 | } | 1619 | } |
1620 | 1620 | ||
1621 | switch (table) | 1621 | switch (table) |
1622 | { | 1622 | { |
1623 | case ROOT: | 1623 | case ROOT: |
1624 | count = load_root(c); | 1624 | count = load_root(c); |
@@ -1631,12 +1631,12 @@ int tagtree_load(struct tree_context* c) | |||
1631 | count = retrieve_entries(c, 0, true); | 1631 | count = retrieve_entries(c, 0, true); |
1632 | cpu_boost(false); | 1632 | cpu_boost(false); |
1633 | break; | 1633 | break; |
1634 | 1634 | ||
1635 | default: | 1635 | default: |
1636 | logf("Unsupported table %d\n", table); | 1636 | logf("Unsupported table %d\n", table); |
1637 | return -1; | 1637 | return -1; |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | if (count < 0) | 1640 | if (count < 0) |
1641 | { | 1641 | { |
1642 | c->dirlevel = 0; | 1642 | c->dirlevel = 0; |
@@ -1646,7 +1646,7 @@ int tagtree_load(struct tree_context* c) | |||
1646 | 1646 | ||
1647 | /* The _total_ numer of entries available. */ | 1647 | /* The _total_ numer of entries available. */ |
1648 | c->dirlength = c->filesindir = count; | 1648 | c->dirlength = c->filesindir = count; |
1649 | 1649 | ||
1650 | return count; | 1650 | return count; |
1651 | } | 1651 | } |
1652 | 1652 | ||
@@ -1660,10 +1660,10 @@ int tagtree_enter(struct tree_context* c) | |||
1660 | int source; | 1660 | int source; |
1661 | 1661 | ||
1662 | dptr = tagtree_get_entry(c, c->selected_item); | 1662 | dptr = tagtree_get_entry(c, c->selected_item); |
1663 | 1663 | ||
1664 | c->dirfull = false; | 1664 | c->dirfull = false; |
1665 | seek = dptr->extraseek; | 1665 | seek = dptr->extraseek; |
1666 | if (seek == -1) | 1666 | if (seek == -1) |
1667 | { | 1667 | { |
1668 | if(c->filesindir<=2) | 1668 | if(c->filesindir<=2) |
1669 | return 0; | 1669 | return 0; |
@@ -1685,27 +1685,27 @@ int tagtree_enter(struct tree_context* c) | |||
1685 | /* lock buflib for possible I/O to protect dptr */ | 1685 | /* lock buflib for possible I/O to protect dptr */ |
1686 | tree_lock_cache(c); | 1686 | tree_lock_cache(c); |
1687 | tagtree_lock(); | 1687 | tagtree_lock(); |
1688 | 1688 | ||
1689 | switch (c->currtable) { | 1689 | switch (c->currtable) { |
1690 | case ROOT: | 1690 | case ROOT: |
1691 | c->currextra = newextra; | 1691 | c->currextra = newextra; |
1692 | 1692 | ||
1693 | if (newextra == ROOT) | 1693 | if (newextra == ROOT) |
1694 | { | 1694 | { |
1695 | menu = menus[seek]; | 1695 | menu = menus[seek]; |
1696 | c->currextra = seek; | 1696 | c->currextra = seek; |
1697 | } | 1697 | } |
1698 | 1698 | ||
1699 | else if (newextra == NAVIBROWSE) | 1699 | else if (newextra == NAVIBROWSE) |
1700 | { | 1700 | { |
1701 | int i, j; | 1701 | int i, j; |
1702 | 1702 | ||
1703 | csi = &menu->items[seek]->si; | 1703 | csi = &menu->items[seek]->si; |
1704 | c->currextra = 0; | 1704 | c->currextra = 0; |
1705 | 1705 | ||
1706 | strlcpy(current_title[c->currextra], dptr->name, | 1706 | strlcpy(current_title[c->currextra], dptr->name, |
1707 | sizeof(current_title[0])); | 1707 | sizeof(current_title[0])); |
1708 | 1708 | ||
1709 | /* Read input as necessary. */ | 1709 | /* Read input as necessary. */ |
1710 | for (i = 0; i < csi->tagorder_count; i++) | 1710 | for (i = 0; i < csi->tagorder_count; i++) |
1711 | { | 1711 | { |
@@ -1717,13 +1717,13 @@ int tagtree_enter(struct tree_context* c) | |||
1717 | continue; | 1717 | continue; |
1718 | 1718 | ||
1719 | source = csi->clause[i][j]->source; | 1719 | source = csi->clause[i][j]->source; |
1720 | 1720 | ||
1721 | if (source == source_constant) | 1721 | if (source == source_constant) |
1722 | continue; | 1722 | continue; |
1723 | 1723 | ||
1724 | searchstring=csi->clause[i][j]->str; | 1724 | searchstring=csi->clause[i][j]->str; |
1725 | *searchstring = '\0'; | 1725 | *searchstring = '\0'; |
1726 | 1726 | ||
1727 | id3 = audio_current_track(); | 1727 | id3 = audio_current_track(); |
1728 | 1728 | ||
1729 | if (source == source_current_path && id3) | 1729 | if (source == source_current_path && id3) |
@@ -1736,7 +1736,7 @@ int tagtree_enter(struct tree_context* c) | |||
1736 | } | 1736 | } |
1737 | else if (source > source_runtime && id3) | 1737 | else if (source > source_runtime && id3) |
1738 | { | 1738 | { |
1739 | 1739 | ||
1740 | int k = source-source_runtime; | 1740 | int k = source-source_runtime; |
1741 | int offset = id3_to_search_mapping[k].id3_offset; | 1741 | int offset = id3_to_search_mapping[k].id3_offset; |
1742 | char **src = (char**)((char*)id3 + offset); | 1742 | char **src = (char**)((char*)id3 + offset); |
@@ -1757,9 +1757,9 @@ int tagtree_enter(struct tree_context* c) | |||
1757 | } | 1757 | } |
1758 | if (csi->clause[i][j]->numeric) | 1758 | if (csi->clause[i][j]->numeric) |
1759 | csi->clause[i][j]->numeric_data = atoi(searchstring); | 1759 | csi->clause[i][j]->numeric_data = atoi(searchstring); |
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | 1762 | ||
1763 | } | 1763 | } |
1764 | } | 1764 | } |
1765 | } | 1765 | } |
@@ -1791,18 +1791,18 @@ int tagtree_enter(struct tree_context* c) | |||
1791 | c->currextra++; | 1791 | c->currextra++; |
1792 | else | 1792 | else |
1793 | c->dirlevel--; | 1793 | c->dirlevel--; |
1794 | 1794 | ||
1795 | /* Update the statusbar title */ | 1795 | /* Update the statusbar title */ |
1796 | strlcpy(current_title[c->currextra], dptr->name, | 1796 | strlcpy(current_title[c->currextra], dptr->name, |
1797 | sizeof(current_title[0])); | 1797 | sizeof(current_title[0])); |
1798 | break; | 1798 | break; |
1799 | 1799 | ||
1800 | default: | 1800 | default: |
1801 | c->dirlevel--; | 1801 | c->dirlevel--; |
1802 | break; | 1802 | break; |
1803 | } | 1803 | } |
1804 | 1804 | ||
1805 | 1805 | ||
1806 | c->selected_item=0; | 1806 | c->selected_item=0; |
1807 | gui_synclist_select_item(&tree_lists, c->selected_item); | 1807 | gui_synclist_select_item(&tree_lists, c->selected_item); |
1808 | tree_unlock_cache(c); | 1808 | tree_unlock_cache(c); |
@@ -1827,7 +1827,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) | |||
1827 | { | 1827 | { |
1828 | struct tagcache_search tcs; | 1828 | struct tagcache_search tcs; |
1829 | int extraseek = tagtree_get_entry(c, c->selected_item)->extraseek; | 1829 | int extraseek = tagtree_get_entry(c, c->selected_item)->extraseek; |
1830 | 1830 | ||
1831 | 1831 | ||
1832 | if (!tagcache_search(&tcs, tag_filename)) | 1832 | if (!tagcache_search(&tcs, tag_filename)) |
1833 | return -1; | 1833 | return -1; |
@@ -1839,7 +1839,7 @@ int tagtree_get_filename(struct tree_context* c, char *buf, int buflen) | |||
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | tagcache_search_finish(&tcs); | 1841 | tagcache_search_finish(&tcs); |
1842 | 1842 | ||
1843 | return 0; | 1843 | return 0; |
1844 | } | 1844 | } |
1845 | 1845 | ||
@@ -1858,7 +1858,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1858 | cpu_boost(false); | 1858 | cpu_boost(false); |
1859 | return false; | 1859 | return false; |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | if (position == PLAYLIST_REPLACE) | 1862 | if (position == PLAYLIST_REPLACE) |
1863 | { | 1863 | { |
1864 | if (playlist_remove_all_tracks(NULL) == 0) | 1864 | if (playlist_remove_all_tracks(NULL) == 0) |
@@ -1882,14 +1882,14 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1882 | to = c->filesindir; | 1882 | to = c->filesindir; |
1883 | direction = 1; | 1883 | direction = 1; |
1884 | } | 1884 | } |
1885 | 1885 | ||
1886 | for (i = from; i != to; i += direction) | 1886 | for (i = from; i != to; i += direction) |
1887 | { | 1887 | { |
1888 | /* Count back to zero */ | 1888 | /* Count back to zero */ |
1889 | if (!show_search_progress(false, files_left--)) | 1889 | if (!show_search_progress(false, files_left--)) |
1890 | break; | 1890 | break; |
1891 | 1891 | ||
1892 | if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek, | 1892 | if (!tagcache_retrieve(&tcs, tagtree_get_entry(c, i)->extraseek, |
1893 | tcs.type, buf, sizeof buf)) | 1893 | tcs.type, buf, sizeof buf)) |
1894 | { | 1894 | { |
1895 | continue; | 1895 | continue; |
@@ -1905,7 +1905,7 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue | |||
1905 | playlist_sync(NULL); | 1905 | playlist_sync(NULL); |
1906 | tagcache_search_finish(&tcs); | 1906 | tagcache_search_finish(&tcs); |
1907 | cpu_boost(false); | 1907 | cpu_boost(false); |
1908 | 1908 | ||
1909 | return true; | 1909 | return true; |
1910 | } | 1910 | } |
1911 | 1911 | ||
@@ -1923,10 +1923,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1923 | #endif | 1923 | #endif |
1924 | , 0); | 1924 | , 0); |
1925 | 1925 | ||
1926 | 1926 | ||
1927 | /* We need to set the table to allsubentries. */ | 1927 | /* We need to set the table to allsubentries. */ |
1928 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; | 1928 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; |
1929 | 1929 | ||
1930 | /* Insert a single track? */ | 1930 | /* Insert a single track? */ |
1931 | if (newtable == PLAYTRACK) | 1931 | if (newtable == PLAYTRACK) |
1932 | { | 1932 | { |
@@ -1936,10 +1936,10 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1936 | return false; | 1936 | return false; |
1937 | } | 1937 | } |
1938 | playlist_insert_track(NULL, buf, position, queue, true); | 1938 | playlist_insert_track(NULL, buf, position, queue, true); |
1939 | 1939 | ||
1940 | return true; | 1940 | return true; |
1941 | } | 1941 | } |
1942 | 1942 | ||
1943 | if (newtable == NAVIBROWSE) | 1943 | if (newtable == NAVIBROWSE) |
1944 | { | 1944 | { |
1945 | tagtree_enter(tc); | 1945 | tagtree_enter(tc); |
@@ -1951,14 +1951,14 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1951 | logf("unsupported table: %d", newtable); | 1951 | logf("unsupported table: %d", newtable); |
1952 | return false; | 1952 | return false; |
1953 | } | 1953 | } |
1954 | 1954 | ||
1955 | /* Now the current table should be allsubentries. */ | 1955 | /* Now the current table should be allsubentries. */ |
1956 | if (newtable != PLAYTRACK) | 1956 | if (newtable != PLAYTRACK) |
1957 | { | 1957 | { |
1958 | tagtree_enter(tc); | 1958 | tagtree_enter(tc); |
1959 | tagtree_load(tc); | 1959 | tagtree_load(tc); |
1960 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; | 1960 | newtable = tagtree_get_entry(tc, tc->selected_item)->newtable; |
1961 | 1961 | ||
1962 | /* And now the newtable should be playtrack. */ | 1962 | /* And now the newtable should be playtrack. */ |
1963 | if (newtable != PLAYTRACK) | 1963 | if (newtable != PLAYTRACK) |
1964 | { | 1964 | { |
@@ -1976,12 +1976,12 @@ bool tagtree_insert_selection_playlist(int position, bool queue) | |||
1976 | if (!insert_all_playlist(tc, position, queue)) | 1976 | if (!insert_all_playlist(tc, position, queue)) |
1977 | splash(HZ*2, ID2P(LANG_FAILED)); | 1977 | splash(HZ*2, ID2P(LANG_FAILED)); |
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | /* Finally return the dirlevel to its original value. */ | 1980 | /* Finally return the dirlevel to its original value. */ |
1981 | while (tc->dirlevel > dirlevel) | 1981 | while (tc->dirlevel > dirlevel) |
1982 | tagtree_exit(tc); | 1982 | tagtree_exit(tc); |
1983 | tagtree_load(tc); | 1983 | tagtree_load(tc); |
1984 | 1984 | ||
1985 | return true; | 1985 | return true; |
1986 | } | 1986 | } |
1987 | 1987 | ||
@@ -1995,7 +1995,7 @@ static int tagtree_play_folder(struct tree_context* c) | |||
1995 | 1995 | ||
1996 | if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false)) | 1996 | if (!insert_all_playlist(c, PLAYLIST_INSERT_LAST, false)) |
1997 | return -2; | 1997 | return -2; |
1998 | 1998 | ||
1999 | if (global_settings.playlist_shuffle) | 1999 | if (global_settings.playlist_shuffle) |
2000 | c->selected_item = playlist_shuffle(current_tick, c->selected_item); | 2000 | c->selected_item = playlist_shuffle(current_tick, c->selected_item); |
2001 | if (!global_settings.play_selected) | 2001 | if (!global_settings.play_selected) |
@@ -2011,7 +2011,7 @@ static struct tagentry* tagtree_get_entry(struct tree_context *c, int id) | |||
2011 | { | 2011 | { |
2012 | struct tagentry *entry; | 2012 | struct tagentry *entry; |
2013 | int realid = id - current_offset; | 2013 | int realid = id - current_offset; |
2014 | 2014 | ||
2015 | /* Load the next chunk if necessary. */ | 2015 | /* Load the next chunk if necessary. */ |
2016 | if (realid >= current_entry_count || realid < 0) | 2016 | if (realid >= current_entry_count || realid < 0) |
2017 | { | 2017 | { |
@@ -2048,12 +2048,12 @@ char *tagtree_get_title(struct tree_context* c) | |||
2048 | { | 2048 | { |
2049 | case ROOT: | 2049 | case ROOT: |
2050 | return menu->title; | 2050 | return menu->title; |
2051 | 2051 | ||
2052 | case NAVIBROWSE: | 2052 | case NAVIBROWSE: |
2053 | case ALLSUBENTRIES: | 2053 | case ALLSUBENTRIES: |
2054 | return current_title[c->currextra]; | 2054 | return current_title[c->currextra]; |
2055 | } | 2055 | } |
2056 | 2056 | ||
2057 | return "?"; | 2057 | return "?"; |
2058 | } | 2058 | } |
2059 | 2059 | ||
@@ -2072,7 +2072,7 @@ int tagtree_get_attr(struct tree_context* c) | |||
2072 | case ALLSUBENTRIES: | 2072 | case ALLSUBENTRIES: |
2073 | attr = FILE_ATTR_AUDIO; | 2073 | attr = FILE_ATTR_AUDIO; |
2074 | break; | 2074 | break; |
2075 | 2075 | ||
2076 | default: | 2076 | default: |
2077 | attr = ATTR_DIRECTORY; | 2077 | attr = ATTR_DIRECTORY; |
2078 | break; | 2078 | break; |