Modify

Opened 8 years ago

Closed 7 years ago

#5168 closed enhancement (fixed)

[Patch] Support for FLV files

Reported by: Espen Solbu Owned by: Alexey Kinyov
Priority: low Component: FlashEmbedMacro
Severity: minor Keywords:
Cc: Trac Release: 0.11

Description

Hello, i was wondering if you could add support for flv files (absolute url like for swf)?

Attachments (0)

Change History (4)

comment:1 Changed 8 years ago by Mario

Hi

I added support for .flv files. It's a hack, but it works :-) The macro call looks like this Embed(flv={Url to the .flv file},purl={URL to the .flv player},w=500,h=400)? I'm using the JW Player

have fun

Mario

comment:2 in reply to:  1 Changed 8 years ago by Mario

ups,....

[[Embed(flv={Url to the .flv file},purl={URL to the .flv player},w=500,h=400)]]

unfortunately , i can not attach the patch, so i'll post it here.

 def expand_macro(self, formatter, name, content):
        """ Produces html code by 'key' and content id.
        """
        args, params = parse_args(content, strict=False)
        
        if 'youtube' in params:
            return embed_youtube(params['youtube'], params)
        elif 'vimeo' in params:
            return embed_vimeo(params['vimeo'], params)
        elif 'swf' in params:
            return embed_swf(formatter, params)
        elif 'flv' in params:
            return embed_flv(formatter, params)
def embed_flv(formatter, params):
    """
    Produces embedding code for SWF by url.
    """
    url = params['flv']
    purl = params['purl']
    # url for attachment
    if url[0] != '/' and url[0:7] != 'http://' and url[0:8] != 'https://':
        if url[:11] != 'attachment:':
            url = 'attachment:%s' % url
        url = extract_link(formatter.env, formatter.context, '[%s attachment]' % url)
        url = '/raw-' + url.attrib.get('href')[1:]
    
    # embed code
    code = '<embed \
src="%(purl)s" \
width="%(w)s" \
height="%(h)s" \
bgcolor=undefined \
allowscriptaccess=always \
allowfullscreen=true \
flashvars="file=%(url)s" \
/>'  % {'url': url, 'purl': purl, 'w': params.get('w', '100%'), 'h': params.get('h', '100%')}

    return code

comment:3 Changed 7 years ago by Ryan J Ollos

Summary: Support of FLV files?[Patch] Support for FLV files

comment:4 Changed 7 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Alexey Kinyov.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.