|
52 | 52 |
|
53 | 53 |
|
54 | 54 | # Import matplotlib stuff |
| 55 | +# try..except works around matplotlib problems described in Git #592, #66 |
55 | 56 | if mainapp.HAVE_MATPLOTLIB_FLAG: |
56 | | - from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg |
57 | | - from matplotlib.figure import Figure |
58 | | - from matplotlib.ticker import MaxNLocator |
| 57 | + try: |
| 58 | + from matplotlib.backends.backend_gtk3agg import FigureCanvasGTK3Agg |
| 59 | + from matplotlib.figure import Figure |
| 60 | + from matplotlib.ticker import MaxNLocator |
| 61 | + except: |
| 62 | + mainapp.HAVE_MATPLOTLIB_FLAG = False |
59 | 63 |
|
60 | 64 | # Classes |
61 | 65 |
|
@@ -684,6 +688,83 @@ def add_combos_for_graphs(self, grid, row): |
684 | 688 | return combo, combo2, combo3, combo4, combo5 |
685 | 689 |
|
686 | 690 |
|
| 691 | + def add_youtube_warning(self, grid, x, y, wid, hei): |
| 692 | + |
| 693 | + """Can be called by any config window tab, especially those that |
| 694 | + provide a way to pass user credentials to the website (such as |
| 695 | + --username/--password, imported browser cookies, .netrc files etc). |
| 696 | + |
| 697 | + As of October 2024, some methods will not work, and some may even |
| 698 | + cause the deletion of a YouTube account. The user should consult the |
| 699 | + latest yt-dlp warnings about this issue, before downloading restricted |
| 700 | + videos: |
| 701 | + |
| 702 | + https://github.com/yt-dlp/yt-dlp/issues/3766 |
| 703 | + Return values: |
| 704 | + |
| 705 | + Args: |
| 706 | + |
| 707 | + grid (Gtk.Grid): The grid on which widgets are arranged in their |
| 708 | + tab |
| 709 | + |
| 710 | + x, y, wid, hei (int): Position on the grid at which the warning is |
| 711 | + placed |
| 712 | + |
| 713 | + Return values: |
| 714 | + |
| 715 | + The new Gtk.Grid on which the warning is placed |
| 716 | + |
| 717 | + """ |
| 718 | + |
| 719 | + # (To avoid messing up the neat format of the rows above, add a |
| 720 | + # secondary grid, and put the next set of widgets inside it) |
| 721 | + grid2 = self.add_secondary_grid(grid, x, y, wid, hei) |
| 722 | + |
| 723 | + frame = self.add_pixbuf(grid2, |
| 724 | + 'attention_large', |
| 725 | + 0, 0, 1, 1, |
| 726 | + ) |
| 727 | + frame.set_hexpand(False) |
| 728 | + frame.set_border_width(self.spacing_size) |
| 729 | + frame.set_size_request(75, -1) |
| 730 | + |
| 731 | + frame2 = Gtk.Frame() |
| 732 | + grid2.attach(frame2, 1, 0, 1, 1) |
| 733 | + |
| 734 | + grid3 = Gtk.Grid() |
| 735 | + frame2.add(grid3) |
| 736 | + grid3.set_border_width(self.spacing_size * 2) |
| 737 | + grid3.set_column_spacing(self.spacing_size * 2) |
| 738 | + grid3.set_row_spacing(self.spacing_size) |
| 739 | + |
| 740 | + label = Gtk.Label() |
| 741 | + grid3.attach(label, 0, 0, 1, 1) |
| 742 | + label.set_markup( |
| 743 | + _( |
| 744 | + 'WARNING! YouTube is trying to block applications like' \ |
| 745 | + + ' Tartube!', |
| 746 | + ), |
| 747 | + ) |
| 748 | + label.set_hexpand(True) |
| 749 | + label.set_alignment(0, 0.5) |
| 750 | + |
| 751 | + label2 = Gtk.Label() |
| 752 | + grid3.attach(label2, 0, 1, 1, 1) |
| 753 | + label2.set_markup( |
| 754 | + '<a href="' \ |
| 755 | + + html.escape('https://github.com/yt-dlp/yt-dlp/issues/3766') \ |
| 756 | + + '" title="' \ |
| 757 | + + _('yt-dlp Known Issues FAQ') \ |
| 758 | + + '">' \ |
| 759 | + + _('Before trying to download restricted videos, read the FAQ!') \ |
| 760 | + + '</a>', |
| 761 | + ) |
| 762 | + label2.set_hexpand(True) |
| 763 | + label2.set_alignment(0, 0.5) |
| 764 | + |
| 765 | + return grid2 |
| 766 | + |
| 767 | + |
687 | 768 | def get_options_applied_text(self, options_obj): |
688 | 769 |
|
689 | 770 | """ Called by OptionsEditWin.setup_name_tab() and |
@@ -901,6 +982,7 @@ def ytdlp_only(self): |
901 | 982 | The formatted string 'yt-dlp only' |
902 | 983 |
|
903 | 984 | """ |
| 985 | + |
904 | 986 | return ' <b>[' + _('yt-dlp only') + ']</b>' |
905 | 987 |
|
906 | 988 |
|
@@ -7951,6 +8033,8 @@ def setup_advanced_authentication_tab(self, inner_notebook): |
7951 | 8033 | ) |
7952 | 8034 | self.add_tooltip('--ap-password PASSWORD', label7, entry7) |
7953 | 8035 |
|
| 8036 | + self.add_youtube_warning(grid, 0, 8, 2, 1) |
| 8037 | + |
7954 | 8038 |
|
7955 | 8039 | def setup_advanced_netrc_tab(self, inner_notebook): |
7956 | 8040 |
|
@@ -8031,6 +8115,8 @@ def setup_advanced_netrc_tab(self, inner_notebook): |
8031 | 8115 | textbuffer.set_text(str.join('', line_list)) |
8032 | 8116 | entry.set_text(netrc_path) |
8033 | 8117 |
|
| 8118 | + self.add_youtube_warning(grid, 0, 4, grid_width, 1) |
| 8119 | + |
8034 | 8120 | # (Signal connect from above) |
8035 | 8121 | button.connect( |
8036 | 8122 | 'clicked', |
|
0 commit comments