Modify

Opened 5 years ago

Closed 4 years ago

#5168 closed enhancement (fixed)

[Patch] Support for FLV files

Reported by: eppa Owned by: rudyryk
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 follow-up: Changed 5 years ago by mwehr

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 5 years ago by mwehr

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 4 years ago by rjollos

  • Summary changed from Support of FLV files? to [Patch] Support for FLV files

comment:4 Changed 4 years ago by rjollos

  • Resolution set to fixed
  • Status changed from new to closed

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.