How to display list item tags in a kodi skin - xbmc

I'm trying to customize the default Kodi skin 'estuary'. My plan is to display the tags of a movie next to the movie title.
The skin uses $INFO[ListItem.Tag] in the DialogVideoInfo.xml template file and Kodi displays the tags nicely when opening the video info screen.
But when I use the $INFO[ListItem.Tag] variable inside e.g. MyVideoNav.xml template nothing is displayed. Here's how I changed the default MyVideoNav.xml template
...
<control type="textbox">
<left>30</left>
<top>240</top>
<width>525</width>
<bottom>100</bottom>
<visible>!ListItem.IsCollection</visible>
<label>Tags: "$INFO[ListItem.Tag]"[CR][CR]$INFO[ListItem.Tagline,[I],[/I][CR][CR]]$INFO[ListItem.Plot][CR][CR]</label>
<autoscroll delay="10000" time="3000" repeat="10000">Skin.HasSetting(autoscroll)</autoscroll>
</control>
...
No matter if the movie is assigned to a tag or not what I see is always Tags: ""
Edit You find the whole MyVideoNav.xml here: https://pastebin.com/dHqyQpHx. In line 52 you'll find my change.

You should use <label>$INFO[ListItem.Tagline]</label> you need to create list item for Tagline first in DialogVideoInfo.xml
Add few lines in DialogVideoInfo.xml (for item-layout) after line no 306 :-
<control type="label">
<left>25</left>
<width>214</width>
<height>67</height>
<top>245</top>
<align>center</align>
<aligny>center</aligny>
<font>font12</font>
<textcolor>grey</textcolor>
<label>$INFO[ListItem.Tagline]</label>
</control>
And Also after line no 360 :
<control type="label">
<left>25</left>
<width>214</width>
<height>67</height>
<top>245</top>
<align>center</align>
<aligny>center</aligny>
<font>font12</font>
<textcolor>grey</textcolor>
<scroll>true</scroll>
<label>$INFO[ListItem.Tagline]</label>
</control>
NOTE: adjust Width and Height by yourself.
Now you can add and use <label>$INFO[ListItem.Tagline]</label> in MyVideoNav.xml
Hope this helps..!

Related

Blogger Emporio templete: Add second line of text on homepage snippets

My blog is https://testfnm.blogspot.com based on the Blogger Emporio template.
On the homepage, under the titles of the snippets, I would like to add a second line of text with the country name.
So for instance, under the title "Milford Sound" I would like to add the country name "New Zealand". Similarly, under Amsterdam, I would like to add Netherlands. And so on...
How do I do that please?
As an alternative to adding a second line of text to the snippets, I have found a method to make the Labels permanently visible on the snippets of the homepage. I have put only one label per post, the label being the country name. Thus against each snippet a label (the country name) is now visible both on desktop and mobile.
I used this CSS code to make the labels visible:
.labels-outer-container {opacity: 1 !important;}
body.feed-view .post-labels {display: inline-block;}
You can see how the results look here: https://www.firozemistry.com

Use the title= HTML attribute with RMarkdown

I am trying to understand if it is possible to insert the HTML title= attribute (not necessarily inside an <abbr> tag) within an RMarkdown document (e.g. a blog post written through blogdown)
From W3C: the title attribute specifies extra information about an element. The information is most often shown as a tooltip text when the mouse moves over the element.
The <abbr title="World Health Organization">WHO</abbr> was founded in 1948.
Couldn't find anything regarding using in in RMarkdown tho
You can write raw HTML in Markdown. However, if you are using Hugo >= v0.60.0, raw HTML will be ignored by default. You need to set an option in your config file to enable it:
[markup.goldmark.renderer]
unsafe= true

Show preview of image in form

I want to achieve the following in a django form, for a models.ImageField:
do not show the standard <input type="file"> button ("choose file" button)
show a preview of the current image, for already populated models
for empty (new) models, show a custom button
clicking on the image preview or the custom button will open a file dialog to select the image from the user's file system
selecting a new image replaces the custom button or the old image preview with the preview of the new image
This seems to me like a normal workflow to select images in a form, but I do not seem to find any fully working solution. All I can find involves hacking around several parts:
styling the label and hiding the standard "choose file" button: https://www.youtube.com/watch?v=4p2gTDZKS9Y
use a widget instead of the standard for forms.FileField.
I have tried to use:
class ImagePreviewWidget(Widget):
def render(self, name, value, attrs=None):
return mark_safe('<img src="/media/%s" width="100px"/>' % escape(value))
For the widget, and I am using this in the form like this:
class DesignCampaignForm(ModelForm):
brand_logo = FileField(widget=ImagePreviewWidget)
This is properly showing the preview of the existing image, but I am unable to click on it to select another file, and even if I was that would not update the preview.
Is there an already available solution for this simple use case?
I haven't been able to find a complete solution, so I have done the following:
use a widget to render a modified ClearableFileInput, rendering an image and an <input> element
style the <input> in the element with CSS, to hide it
make sure that clicking in the image triggers the hidden <input> element, wrapping the <img> in a <label> and using the for attribute
add some javascript to replace the image preview whenever the selection in the <input> element changes
whenever the selection is cleared, show the original preview
A gist can be found here.
In my final solution (not yet in the gist), I have added a button for when the image is not yet selected.
edit: Gist only works for Django before version 1.11.x.
class ClearableFileInput has since been gutted and changed

Add custom HTML class property to selected block in a QTextEdit

I am not new to Qt, but I can't find how to add a custom css class to the selected block in a QTextEdit.
As far as I know,format is changed whit code like this:
QTextCursor cursor = textEdit->textCursor();
QTextBlockFormat bfmt;
// Apply format changes
cursor.setBlockFormat(bfmt);
When I do this, the generated HTML code creates a span with inlined style in it, but what I want is to insert the css class:
<SPAN class='myclass'>text</span>
I am missing a function inside QTextBlockFormat to set the css class of the text.
You should be able to emulate this behavior by manually adding <span style=""> tags to your selected text:
QString oldText = cursor.selectedText();
// not the best way to concat three strings, but for example only...
cursor.insertHtml(QString("<span class=\"%1\">%2</span>").arg("myclass").arg(oldText));
selectedText() will return currently selected text, and insertHtml() will insert new text at the beggining of the cursor, deleting current selection, if any.

Orchard CMS: Creating bookmark for List item

We're creating a page in Orchard CMS using the 'List' Content Type. We want to add some hyperlinks at the top of the list, that will jump down the page to specific items in the list.
We specifically don't want to just link to the individual page for the list item, but jump down to where it is in the list, and because the list items are rendered using the same View part, we can't of course just hard code the bookmarks.
We've been customising the View Part in VS and know that the list item title is generated using the code:
#Display(Model.Header)
And this generates < h1 > and < a > tags to wrap around the title like this:
< h1 shape-id="5" >< a href="/Orchard/Contents/Item/Display/36" shape-id="5" >Marketing< /a >< /h1 >
However, we can't find a way to get the Display() method to include a 'name=' clause which we can then use as the bookmark.
We've also tried adding a new tag just above the exiting code, e.g.:
< a name="#Model.Header" >< /a >
#Display(Model.Header)
But of course the Model.Header is an object reference, and not some text, so this failed. After this we've got lost with various ways trying to find a property of the Model object to fetch the Title as text but couldn't.
There must be a way to overload the Display() method to get it to include the 'name=' clause, anyone got any ideas?
Model.Header is just a zone. What really renders the title is a shape that was added to that zone. You should really use Shape Tracing (part of the Designer Tools module) to understand what the hierarchy of shapes looks like. You don't need to "overload the display method". What you need is to override the template for the shape that is rendering the title (which is not Model.Header but something inside it).
You might want to read this: http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx and this http://weblogs.asp.net/bleroy/archive/2011/05/23/orchard-list-customization-first-item-template.aspx
Try:
<a name="#Model.Header.Items[0].Title" />
It's not pretty, but it worked for me when I dropped this in an alternate template for a biography content type I created (Views/Content-Bio.Summary.cshtml).
Based on Bertrand's suggestion, instead you can try:
<a name="#Model.Title" />
in your template alternate.